Laravel 6 – @push and @stack

Hello everyone I’m new to Laravel and I’m currently using Laravel 6.0 For some reason my javascript using @push is not working. The script only works when I paste the code in the blade file and not using the asset folder. add.blade.php @extends(‘layouts.app’) @section(‘content’) // Long HTML code @endsection @push(‘scripts’) <script src=””></script> @endpush layouts >…

Laravel what relation to use in order to see data from another model and column

I have two models Item: protected $fillable = [ ‘code’, ‘name’, ‘uom’ ]; public function recipe() { return $this->belongsTo(‘App\Recipe’); } Recipe: protected $fillable = [ ‘recipecode’, ‘itemcode’, ‘qty’ ]; public function item() { return $this->hasMany(‘App\Item’); } In migration I have: public function up() { Schema::table(‘recipes’, function (Blueprint $table) { $table->foreign(‘itemcode’)->references(‘code’)->on(‘items’); }); } In RecipesController I…

Laravel – Verified middleware is rejecting verified users

So I have this problem where a user will successfully verify his/her email, but then when they enter a route with the “verified” middleware, they will be rejected? Protected Route: Route::get(‘/venue/{venue}’, ‘profileController@index’)->name(‘profile.show’)->middleware(‘verified’); Ensure email is verified class: public function handle($request, Closure $next, $redirectToRoute = null) { if (! $request->user() || ($request->user() instanceof MustVerifyEmail && !…

Laravel Eloquent WhereIn 0 = 1

I’ve trying to use a whereIn clause, but I get a rare behavior. This is my relationship: return $this->belongsToMany(‘App\Models\Role’, ‘system_users_roles’, ‘user_id’, ‘role_id’) ->where(function ($query) { $query->where(function ($querypermissions) { $querypermissions->whereNotNull(‘service_id’) ->whereHas(‘permissions’, function ($q) { $q->whereIn(‘app_id’, $this->apps->pluck(‘id’)); }); }) ->orWhereNULL(‘service_id’); }); This code return some rows, but one is missing (the one I need, in this case).…

Laravel Migrations: Foreign Key on different connection (different DB)

Possible in Laravel 5 Schema::create(‘posts’, function (Blueprint $table) { …. $table->integer(‘user_id’)->unsigned()->nullable(); $table->foreign(‘user_id’)->references(‘id’)->on(‘auth.users’)->onDelete(‘cascade’); }); This will reference to the users table on the auth database. Question How can I make it though that it looks in the auth connection, rather than directly in the auth database? Reason I’m asking because each developer or environment could have…