Category : crud

I want to read a .tsv file that comes from an input. But only can get the first line. dd($request->file) returns this: -test: false -originalName: "ürünler_2021-04-08_02-39-00.tsv" -mimeType: "application/octet-stream" -error: 0 #hashName: null path: "C:xampptmp" filename: "php1D74.tmp" basename: "php1D74.tmp" pathname: "C:xampptmpphp1D74.tmp" extension: "tmp" realPath: "C:xampptmpphp1D74.tmp" aTime: 2021-04-09 05:08:47 mTime: 2021-04-09 05:08:47 cTime: 2021-04-09 05:08:47 inode: 10133099161895727 ..

Read more

This is my update method, I’m using simple polymorphic relation morphTo and morphOne. I’m having trouble in updating product model. public function update(Request $request, Product $product) { $product->name = $request->name; $product->price = $request->price; $product->discount = $request->discount; $product->category_id = $request->category; $product->brand_id = $request->brand; $product->is_active = $request->is_active; if($request->hasFile(‘url’)) { $image = $request->file(‘url’); $filename = $image->getClientOriginalName(); $image->move(public_path(‘storage/products’), $filename); ..

Read more

With the following code, I dynamically add fields for a different number of product properties: $("#addRow").click(function () { var html = ”; html += ‘<div id="inputFormRow">’; html += ‘<div class="input-group mb-3">’; html += ‘<input type="text" name="properties[{{i}}][key]" class="form-control m-input ml-3" value="{{ old(‘properties[‘.$i.’][key]’) }}" placeholder="Key" autocomplete="off">’; html += ‘<input type="text" name="properties[{{i}}][value]" class="form-control m-input ml-3" value="{{ old(‘properties[‘.$i.’][value]’) }}" ..

Read more

I am making an application in Laravel. I’ve created a form to save a model (Repair). But when I save the form, you see it redirecting, but nothing saves. No error or success message is shown? The store function in the RepairController.php: public function store(Request $request) { $this->validate($request, [ ‘customer_id’ => ‘required’, ‘defect’ => ‘required’, ..

Read more

There is a table house. It has four columns (where the path to the downloaded file should be saved). I tried to download one file in the controller for the test, but it did not appear in the database $this->validate($request, [ ‘passport’ => ‘required’ ]); $homes = Houses::query()->create([ ‘passport’ => $request->get(‘passport’) ] ); $request->validate([ ‘file’ ..

Read more

I’m laravel beginner and use L8. i have a category table and it has parent_id for my subcategories . i use one table and model to CRUD them but my controller and view are separate. it means : categories table Category model categoryController SubCategoryController categories.blade sub_categories.blade in my subcategory-index.blade.php i want to show categories but ..

Read more

I have laravel project When I edit the Training -> Location Address (‘location’ in database), it give message that my Training is succesfully edited. but when i check the details, Location Addres doesn’t changed Can anyone give me clue? Here I attach some part of the code in Trainingcontroller public function store(Request $request){ try { ..

Read more

Whenever I try to update the record in laravel in 8.2.1 version this error (POST http://127.0.0.1:8000/add-student 500 (Internal Server Error) ) comes to me and when i see in console it says ( xhr.send( ( options.hasContent && options.data ) || null ); ) two picture are also attached 1. My Code in inside.blade.ph and second ..

Read more

I just learned laravel web programming about 2 weeks ago I have 2 tables, namely anggotas and simpanans which has one-to-many relationship one anggota (id_anggota as pk) can have many simpanan(id simpanan as pk) I use id_anggota as a foreign key in the simpanans table when I delete one of the data in the simpanans ..

Read more

I have a livewire CRUD component to make posts. It worked perfectly before I tried to add a choice of categories. This is a piece of code, where I try to choose a category: <select class="form-select" aria-label="Default select example"> <option wire:model="category_id" selected>Выберите категорию</option> @foreach($categories as $category) <option value="{{ $category->id }}"> {{ $category->name }} </option> @endforeach ..

Read more

i used ajax for crud in laravel. when update or add data, add new row to list but return string ‘undefined’ and when refresh this page show real text. how to resolve this problem? Controller: public function update(Request $request, $user_id) { $user = User::where(‘id’, $user_id)->update([ ‘name’ => $request->input(‘name’), ’email’ => $request->input(’email’), ‘password’ => Hash::make($request->input(‘password’)), ]); ..

Read more

I have existing data from my SQL database which I want to update for renewal on the membership in the laravel project I’m creating. I want a foreign key user_id which links my users table to my money_trades table. Schema in money_trades table Schema::create(‘money_trades’, function (Blueprint $table) { $table->bigIncrements(‘id’); $table->string(‘mt_number’); $table->unsignedBigInteger(‘user_id’); $table->string(‘bank’); $table->string(’email’); $table->string(‘mt_first_name’); $table->string(‘mt_last_name’); ..

Read more