skip to Main Content

Laravel polymorphic relationship not working in Laravel Nova

I have the following Models and relationships. AppSubscriber.php <?php namespace AppModels; use IlluminateDatabaseEloquentModel; use IlluminateSupportFacadesDB; use IlluminateSupportStr; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateNotificationsNotifiable; use GrosvLaravelPasswordlessLoginTraitsPasswordlessLogin; class Subscriber extends Authenticatable { use Notifiable, PasswordlessLogin; public function customFieldValues() { return $this->morphMany(CustomFieldValue::class, 'customFieldValueable');…

VIEW QUESTION

Laravel Flash Message not displaying message

I was to trying to show flash message with following controller. But it's not displaying any message on view page. public function deleteTag(Request $request) { DB::table('tags') ->where('id', $request->id) ->where('user_id', Auth::user()->id) ->delete(); Session::flash('error', 'Tag deleted successfully' ); return redirect('tags'); } In…

VIEW QUESTION

Cannot use a global variable in php

I have this function in a controller in laravel 10 public function change($id) { DB::beginTransaction(); try{ $current_period=Period::where('current',true)->first(); $current_period->current=false; $current_period->save(); $new_period=Period::findOrFail($id); $new_period->current=true; $new_period->save(); //set person's memberSince and pay_mode to what is in the person_period pivot table $persons=Person::all(); $persons->each(function ($person,$key){ global $new_period;…

VIEW QUESTION
Back To Top
Search