skip to Main Content

How I can check that unique data in pivot table already exists? – Laravel

In laravel 9 I have table pivot table defined : Schema::create('article_vote', function (Blueprint $table) { $table->id(); $table->foreignId('article_id')->references('id')->on('articles')->onUpdate('RESTRICT')->onDelete('CASCADE'); $table->foreignId('vote_id')->references('id')->on('votes')->onUpdate('RESTRICT')->onDelete('CASCADE'); $table->unique(['vote_id', 'article_id'], 'article_vote_vote_id_article_id_index'); ... }); and having in both models methods with belongsToMany I can refer articles of a vote as :…

VIEW QUESTION

Collection column exists, but somehow doesn't at the same time – Laravel

i am at this error for some hours now, and i cant resolve it by myself. this is the code: $repeated_entry = Product_Market::where('produto_id', '=', $product->id) ->where('market_id', '=', $market->id)->get(); $repeated_entry_update = Product_Market::where('produto_id', '=', $product->id) ->where('market_id', '=', $market->id); if($repeated_entry->count()) { $repeated_entry_update->update(['amount_requested' =>…

VIEW QUESTION

Turn on CSRF protection for a group of GET routes in Laravel

I have the following group of GET routes on Laravel: Route::get('/location/get', 'Ajax@getProducts'); Route::get('/products/get', 'Ajax@getProducts'); Route::get('/schedule/get', 'Ajax@getProducts'); I want to protect those routes with the automatically generated CSRF token from Laravel. I have read some workarounds about overriding method: VerifyCsrfToken@isReading(...), but…

VIEW QUESTION

Call to undefined method YoeunesToastrToastr::message() (View: /home/_ke_nzy_/house/resources/views/payment-view.blade.php) – Laravel

This is where Toastr is being called on my payment.view.blad.php file <script src="{{asset('assets/admin')}}/js/custom.js"></script> <script src="{{asset('assets/admin')}}/js/vendor.min.js"></script> <script src="{{asset('assets/admin')}}/js/theme.min.js"></script> <script src="{{asset('assets/admin')}}/js/sweet_alert.js"></script> <script src="{{asset('assets/admin')}}/js/toastr.js"></script> <script src="{{asset('assets/admin')}}/js/bootstrap.min.js"></script> {!! Toastr::message() !!} The error sends me to a Facade.php under vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261 public static function setFacadeApplication($app) {…

VIEW QUESTION
Back To Top
Search