Category : laravel-7

I’d like to ask. I want to make excel import feature using laravel-excel package. Which, the data I imported has relational values ​​to another table. so, when i import excel it will save the data in two tables. the first table, stores data such as name and file path. And the second table, saves the ..

I need to get the model of newly created records $data = [[‘name’ => ‘john’], [‘name’ => ‘Doe’]];$result = Model::insert($data); But when I checked the$result variable it was Boolean. How can I get the newly created records? Sourc..

i have 5 filter , kampus,fakulti,program ,semester and status so each filter is always been filter with status it means the status filter will be the selection of switch case and the other filter will be condition in the switch case example : if($student){$today = date("Y-m-d"); switch($request->stat){ case ‘Y’: if($request->kampus != "-" && $request->fakulti .. Read more In a Laravel context, I’ve got this messages page, with all the messages belonging to a specific user. Initially all messages are not readed, so I put a button to change the boolean in DB (from 0 to 1) and finally show the message. I’m doing this: The view @if ($message->readed != 0) <p class="card-text ..

Im upgrading from laravel 7 to laravel 8 and Im trying to make a http request to a laravel API hosted locally. If I use http://localhost or http://127.0.0.1, the requests give a response. But if I use a http://192.168.x.x address, I get an error Error: connect ECONNREFUSED. How do I use http://192.168.x.x ? https://i.stack.imgur.com/98Z1r.png Source: ..

I’m in Laravel, Vue as frontend. I try to explain to you my project: Is a website for musicians, you can do research based on genres (using a select) and you will be redirected to a page where all the musicians of that genre are. Here, in this page I’ve got two filters: Filter for ..

I’m trying to validate fields in my form and using unique rule $validator = Validator::make($request->all(),[ ’email’ => [‘required’, ‘string’, ’email’, ‘max:255’, Rule::unique(‘users’)->where(function ($q) {$q->whereNotNull(‘password’); }) ], ‘password’ => [‘required’, ‘string’, ‘min:5’, ‘confirmed’,’min:8′], ‘password_confirmation’ => [‘min:8’] ]); getting this error : message: "Call to undefined method IlluminateContractsValidationRule::unique()", used this namespace : use IlluminateContractsValidationRule; Any suggestion ..

I am relatively new to Laravel and Livewire. I am trying to make a custom registration form to register a new user. By custom I mean, I did not use Laravel’s registration. I implemented it by doing create operation. It works on my local machine but it is not working on the production server. If ..

I am using Laravel 7 for my project. Although I am using VueJS within Laravel. When I try to upload an image, I get the error (419 | page expired) immediately after submitting the form!. But in the console window, I can confirm that the token is there. This is my blade file: <html> <head> ..

SELECT id, house_name, ( SELECT timestampdiff(DAY, ‘2021-09-10’, date_from) FROM bookings WHERE house_id = houses.id ORDER BY id DESC LIMIT 1 ) AS day_in FROM houses WHERE id NOT IN ( SELECT house_id FROM bookings WHERE ‘2021-09-10’ BETWEEN date_from AND date_to ) Sourc..

Hi im having an error while trying to download an uploaded file. Im using laravel 7. The error is 404 page not found and it might be because the directory do not match. This is my download method in my controller: public function download($file){ return response()->download(‘storage/archivos’.$file); } My directories are public->storage->archivos->(each file) This is my ..

well i’ve made fully dynamic routes on laravel for friendly url’s reasons, something like this: Route::get(‘/{first}/{second?}/{third?}/{fourth?}/{fifth?}/{sixth?}/{seventh?}’,’[email protected]’); so, the user can access any tree data level from scratch. My problem is when some page has a link to any file on my system, like: mysite.com/storage/app/archives/9b1fe45fdf5db9203341b73931a9308a.pdf that is matching on the route with my dynamic routing, and ..

Here’s the situation, I’m in a Vue context, Laravel as backend. In my homepage I have a select for searching musicians based on their genre, so when I get to this page I want to show in each musician card the stars relative to the average votes received. But I’ve got problems to manipulate the ..

Hi im implementing a script in a blade view in a laravel project and i get the following error: "TypeError: discount is not a function" I tried my code in a new index.html file which is not a laravel project and there it does work, so my problem might be something with mi blade view. ..

I created a project in Laravel-7. When I try to upload an image, I get the error (419 | page expired). but in the console window I can confirm that the token is there. This is my blade file: <html> <head> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>app</title> <script> (function(){ window.Laravel = { csrfToken: ‘{{ csrf_token() ..

Hi i calculated a discount in my controller by requesting in a form the percentage and the sale_price, so i did this: public function store(Request $request){ dd($request->all()); $presupuestoProducto = new PresupuestoProducto();$presupuestoProducto->sale_price = $request->sale_price;$presupuestoProducto->discount_percentage = $request->discount_percentage;$presupuestoProducto->discount = ($sale_price *$discount_percentage)/100; $presupuestoProducto->save(); Session::flash(‘success’); return redirect()->route(‘presupuestos-productos.view’); } But now i want to make the result .. Read more Hi im trying to make a field in my view which is dicount (amount) to be auto calculated by doing the following: discount_amount=(sale_price * discount_percentage)/100 create_presupuestos_productos_table: public function up() { Schema::create(‘presupuestos_productos’, function (Blueprint$table) { $table->id();$table->unsignedBigInteger(‘presupuesto_id’); $table->foreign(‘presupuesto_id’)->references(‘id’)->on(‘presupuestos’);$table->unsignedBigInteger(‘product_id’); $table->foreign(‘product_id’)->references(‘id’)->on(‘products’);$table->integer(‘quantity’); $table->decimal(‘sale_price’);$table->text(‘sale_coin’); $table->integer(‘discount_percentage’);$table->decimal(‘discount’); $table->decimal(‘AlicuotaIVA’);$table->text(‘commentary’); $table->timestamps(); }); This is the logic of my .. Read more Before I put some else condition codes, my controller was like this : And when I tried to login with this codes, it actually worked. function login(Request$request) { $validate_admin = User::where(’email’,$request->input(’email’)) ->first(); if($validate_admin) { if(Hash::check($request->input(‘password’), $validate_admin->password)){ if($validate_admin->email_verified == "yes") { Auth::loginUsingId($validate_admin->id);$request->session()->put(‘id’, $validate_admin->id);$validate_admin->last_login = now(); $validate_admin->save(); if($validate_admin->account_status == ‘1’ && $validate_admin->email_verified == .. Read more I try to add an .ics file to some of my emails, but on mailtrap I don’t get the attachment, I get only the content.. Not sure if I’m doing something wrong. public function toMail($notifiable) { $subject = some data..;$content = some data..; $filename = "invite.ics";$data[0] = "BEGIN:VCALENDAR"; $data[1] = "PRODID:-//Google Inc//Google Calendar .. Read more I’m using Laravel api.php routes and I need to filter musicians based on their common genre, so after the select is clicked I want to switch page and go to a page where I’ve got all the musicians with the choosed genre. The problem is, no matter wich genre I choose from the select, it .. Read more I used composer to install mpdf composer require carlos-meneses/laravel-mpdf did all the settings in config/app.php file. The webfonts TTF files copied to resources/fonts/ folder. Added this to your configuration file (/config/pdf.php): <?php return [ ‘custom_font_dir’ => base_path(‘resources/fonts/’), // don’t forget the trailing slash! ‘custom_font_data’ => [ ‘examplefont’ => [ ‘R’ => ‘fa-regular-400.ttf’, // regular font .. Read more I’m trying to attach musician_id, sponsorship_id and end_date to the pivot table (musician_sponsorship) but I get this error: This is the function where I need to attach data to the pivot table, as soon as the payment with braintree goes well I need to fill the pivot with all the data. public function payment(Request$request, ..
The amount I’m passing seems correct, but I got always an error. As I checkout the amount is invalid, even if I’m passing a float, and this error is shown on the page after submit: The payment function public function payment(Request $request) {$data = $request->all(); // dd($data[‘price’]); \$gateway = new BraintreeGateway([ ‘environment’ => config(‘services.braintree.environment’), ..