Category : model

I have 2 Models (SuperRubriques and CustomRubriques) using the same table rubriques in DB. When I delete from SuperRubriques, I would like to deleguate the delete to CustomRubriques (as CustomRubriques has a hasOne association with extended_rubriques that SuperRubriques doesn’t know). For info, the rubriques table in DB has the field model containing ‘CustomRubriques’ (i.e the ..

Read more

my column "conversion_rate" won’t update, my "iso" column updates without any problem. I tried changing the column’s type in the model but nothing helps. $feed = simpleXML_load_file($url,LIBXML_NOCDATA); foreach ($feed->list->currency as $currency) { if (Currency::all()->contains(‘iso’, $currency[‘iso_code’])) { Currency::where("iso", $currency[‘iso_code’])->get()->first()->update([‘conversion_rate’ => 2.00]); } } edit: My database stucture Schema::create(‘currencies’, function (Blueprint $table) { $table->id(); $table->string(‘iso’); $table->decimal(‘conversion_rate’); $table->timestamps(); ..

Read more

My application was working good but when I installed Livewire, I’m getting error in breadcrumbs like this. Call to undefined method AppTag::getChildrenAttribute() (View: D:Websiteecommerceresourcesviewslayoutsratings.blade.php) ShopController public function show($slug) { $tag = Tag::where(‘slug’, request()->tag)->get()->first(); $tags = Tag::where(‘slug’, request()->tags)->get()->first(); $product = Product::where(‘slug’, $slug)->firstOrFail(); return view(‘layouts.product’)->with([ ‘product’ => $product, ‘tags’ => $tags, ‘tag’ => $tag, ]); } Livewire/ProductRatings.php ..

Read more

I need to convert my password to hash_password on my Model, this is my code; public function Registrar($data) { try { $sql = "INSERT INTO tbllogins (name, username, password, idrol, email) VALUES (?, ?, ?, ?, ?)"; $this->pdo->prepare($sql) ->execute( array( $data->name, $data->username, $data->password, $data->idrol, $data->email ) ); } catch (Exception $e) { die($e->getMessage()); } } ..

Read more