Bind model on Request in store method Laravel
I want to store books, with title, year and already existing Author. An author is saved in a table authors that have a one to many relationship with books table. To create a book i have a from with two…
I want to store books, with title, year and already existing Author. An author is saved in a table authors that have a one to many relationship with books table. To create a book i have a from with two…
I deleted a category which is an f-key of the items table. Now the view has an error saying 'Attempt to read property "category_name" on null'. How do I render a null foreign key? I tried if-else: @if({{$item->category->category_name}} === 'null')…
Is it possible to combine multiple orWhere() inside one where()? E.g. The following: $query->where(function($query){ $query->where('text1', '=', $_GET['lorem']) ->orWhere('text2', '=', $_GET['lorem']) ->orWhere('text3', '=', $_GET['lorem']) ->orWhere('text4', '=', $_GET['lorem']); }); Would look something like this: $query->where(function($query){ $query->where(['text1' || 'text2' || 'text3' || 'text4'],…
I'm working with Laravel 5.8 and I have made this Controller method for creating some records inside the DB. public function doTheUpload(Request $request) { try{ $request->validate([ 'video' => 'nullable|mimes:mp4', 'video_thumb' => 'required|mimes:jpg,png,jpeg', 'video_name' => 'required', 'video_desc' => 'nullable', 'available_download' =>…
I am trying to get a Laravel controller to return to a route after a create function is complete. I have the following code: public function store(Request $request) { Community::create($request->validated() + ['user_id' =>auth()->id()]); Return to route('communities.index'); } It is returning…
I can't delete a category because it is a foreign key in the items table. How can I do it? How can I make a deletion in category and make $category_id null in the items table? I tried making a…
I have a problem displaying errors message in update modal form. I'm using laravel request for validation and AJAX to submit form inside a modal. I would like to see the error message for each field that are inputted incorrectly.…
I have these 2 tables: Table one(parties): public function up() { Schema::create('parties', function (Blueprint $table) { $table->id(); $table->string('full_name'); $table->string('ic_passport'); $table->string('nationality'); $table->string('income_tax_no'); $table->string('income_Tax_filing_branch'); $table->string('phone_no'); $table->string('email'); $table->timestamps(); }); } Table two(corraddresses): public function up() { Schema::create('corraddresses', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('party_id');…
I have installed "laravel/jetstream": "^2.9" on "laravel/framework": "^8.75". When I accessed Profile Information page, it doesn't load necessary information into relevant form fields.Please help me with this isses. Even I have tried reinstalling Jetstream separately. Problem still exists.
I have a Laravel 6 app and am trying to pass two parameters from my view's form to my controller via a resource route. I can pass one, no problem, but passing two gives the same error: Too few arguments…