Category : laravel-7

I want to use the drop down menu, and I have a table below. How do I show the data in this table on Blade? My problem is showing submenus. (Parent_id and child item) public function up() { Schema::create(‘menu_items’, function (Blueprint $table) { $table->id(); $table->unsignedBigInteger(‘menu_id’); $table->string(‘title’,255); $table->string(‘url’,255)->nullable(); $table->string(‘target’,255)->nullable(); $table->string(‘icon_class’,255)->nullable(); $table->string(‘color’,255)->nullable(); $table->integer(‘order’); $table->string(‘route’,255)->nullable(); $table->text(‘parameters’)->nullable(); $table->foreign(‘menu_id’)->references(‘id’)->on(‘menus’); $table->integer(‘parent_id’)->nullable(); ..

Read more

I am working with Laravel and Google Socialite and these days I began to receive the following problem from several accounts: Undefined index: family_name {"exception":"[object] (ErrorException(code: 0): Undefined index: family_name at /home/brooklyn/Sistema/app/Http/Controllers/Auth/LoginController.php:101) I receive the error in the following line: ‘apellido’ => $userSocialite->user[‘family_name’], In the snippet: $user = User::where(’email’, $userSocialite->getEmail())->first(); if(!$user){ $user = User::create([ ‘name’ ..

Read more

I’m trying to create a new table for my database. I previously created a table (tipo) with a PK (IdCorso), then another table(corsoscii) with a foreign key associated with tipo. When I execute the artisan command for corsoscii php artisan migrate –path=’./database/migrations/2021_02_23_155544_create_corsoscii_table.php’ it gives me this error: ("SQLSTATE[HY000]: General error: 1005 Can’t create table impianto_scii.corsoscii ..

Read more

I am trying to save image in storage. Here is my code public function uploadEducationalInstitutionLogo(Request $request) { if ($request->hasFile(‘logo’)) { $file = $request->file(‘logo’); $fileName = time() . $file->getClientOriginalName(); $img = Image::make($file); $img->fit(820, 312, function (Constraint $constraint) { $constraint->upsize(); }); Storage::putFileAs(‘institution-logo’, (string)$img->encode(null, 95), $fileName); return response()->json([ ‘filename’ => $fileName ]); } } Here it’s throwing following ..

Read more

I’ve been stuck with Broadcasting on private channel in authentication part. What I have done is, I made custom authEndpoint in Echo server "authEndpoint": "/broadcastAuth", Controller: public function broadcastAuth(Request $request){ $channel = $this->normalizeChannelName($request->channel_name); $broadcaster = new CustomBroadcaster(); $channelAuth = $broadcaster->verifyUserCanAccessChannel($request, $channel); if($channelAuth){ return true; } return response()->json([ ‘message’ => ‘Not allowed’ ], 403); } I ..

Read more

I want to hash password with md5 instead of bcrypt in laravel 8. In my login controller LoginController.php : protected function credentials(Request $request) { return [‘user_name’ => $request->{$this->username()}, ‘password’ => md5($request->password), ‘actif’ => ‘Y’]; } And in my UserController I have: public function store(Request $request) { $this->validationRules($request); $user = new User(); $user->password = md5("00000000"); $user->actif ..

Read more

When ever I tries to use live wire data binding It give 404 error contact-form.blade.php <div wire.transition.fade key="unique-key"> <input wire:model="named" class="w-full px-5 py-3 border border-gray-400 rounded-lg outline-none focus:shadow-outline" type="text" placeholder="Email Address" /> {{$named}} </div> <?php Contactform.php namespace AppHttpLivewire; use LivewireComponent; class ContactForm extends Component { public $named="jelly"; public function render() { return view(‘livewire.contact-form’,[‘named’=>$this->named])->layout(‘layouts.app’);; } public ..

Read more

I’m using laravel 7 voyager 1.4, I’m also using customization for edit-add.blade.php views, for one of my breads. I’m using voyager’s controller (no override on controllers). I’ve tried adding ajaxForm like this: var bar = $(‘.bar’); if (bar.length === 0) return; var percent = $(‘.percent’); var status = $(‘#status’); var remainingTimeDisplay = $(‘#remainingTime’); var uploadSpeed ..

Read more

I was trying to mass update the record with the same foreign key. But I encounter a problem. If I use $products = $products::findorfail($prod_id); It manages to update a single column. Then when I trying using $products = $products::query()->where(‘product_id’, $prod_id)->get(); I encounter "Method IlluminateDatabaseEloquentCollection::options does not exist.", How do I overcome this problem. Here is ..

Read more

I’m having the error below, I’ve searched about it, but couldn’t find a way. I’ve checked the permission, 644 for all files, and 755 for all folders in laravel project folder. Warning: require(/home3/USERNAME/laravel/vendor/composer/../markbaker/matrix/classes/src/Functions/adjoint.php): failed to open stream: No such file or directory in /home3/USERNAME/laravel/vendor/composer/autoload_real.php on line 69 Warning: require(/home3/USERNAME/laravel/vendor/composer/../markbaker/matrix/classes/src/Functions/adjoint.php): failed to open stream: No such ..

Read more

We are transforming an old project to Laravel 7 the users table doesn’t follow laravel naming the id column is named "UserId" and the problem it is not auto increment I already set in the User model protected $primaryKey = ‘UserId’; how can I alter the column to be Auto-Increment, keep in mind it is ..

Read more

I’m using https://github.com/barryvdh/laravel-dompdf to download pdf but it’s adding border around the content and it’s ignoring the html tags. It’s simply showing the html tags on pdf file. This is my controller: public function download(Request $request, $id) { // dd($request); // $pdf = PdfToWord::find($id); $ptw = Ebook::where(‘id’,$id)->orderBy(‘id’, ‘desc’)->first(); // $idd = $ptw->id; $ebook = EBookChapter::where(‘ebook_id’,$id)->get(); ..

Read more