How to ignore all related data in laravel

User.php public function roles() { return $this->belongsToMany(Role::class)->withTimestamps(); } public function hasRole($role) { if($this->roles()->where(‘name’,$role)->first()) return true; else return false; } public function teams() { return $this->belongsToMany(Team::class)->withTimeStamps(); } Team.php public function users() { return $this->belongsToMany(User::class)->withTimeStamps(); } Role.php public function users() { return $this->belongsToMany(User::class)->withTimestamps(); } Now i want to get all users that are not engaged with any…

Unable to locate Mix file when deploying laravel to shared hosting

We tried deploying our laravel server by uploading our laravel folder to the linux server. We put the public folder in the public_html/laravelsite and the everything else in the a folder called laravelsite. We added $this->app->bind(‘path.public’, function() { return base_path().’/../public_html’; }); to our AppServiceProvider. But when viewing the site in the browser we get the…

Laravel 5.8 Creating default object from empty value

When I try to update a record, I get an ErrorException “Creating default object from empty value” and points to my controller to $products->name = $request->input(‘name’) line. ProductController public function update(Request $request, $id) { $products = Product::find($id); $products->name = $request->input(‘name’); $products->category_id = $request->select(‘category_id’); $products->description = $request->input(‘description’); $products->price_neto = $request->input(‘price_neto’); $products->iva = $request->input(‘iva’); $products->price_total = $request->input(‘price_total’);…

Laravel 6 Custom validation error ‘class does not exist’ when overriding FormRequest’s failedValidation method

I created a custom validation class located in app\Http\Requests: <?php namespace App\Http\Requests; use App\Http\Requests\BaseFormRequest; class RegisterUserRequest extends BaseFormRequest { protected static $NEEDS_AUTHORIZATION = false; protected static $FORM_RULES = [ ‘first_name’ => ‘required|string|max:80’, ‘last_name’ => ‘required|string|max:80′, ’email’ => ‘required|unique:users|email’, ‘password’ => ‘required|string|min:6|confirmed’, ‘terms_conditions’ => ‘accepted’ ]; } and extends BaseFormRequest in the same directory: <?php namespace…