skip to Main Content

Cascade delete in Laravel

I have a example of cascade delete but it looks too big and complicated, is there a way to shorten this code? protected static function boot() { parent::boot(); static::deleted(function ($parent) { // $versions = $parent->game_versions(); $versions = $parent->game_versions; foreach($versions as…

VIEW QUESTION

Laravel – Attempt to read property "episodes" on null

I wrote a code that sums the number of minutes of several videos together. But it shows the following error: Attempt to read property "episodes" on null public function setCourseTime($episode) { $course = $episode->course; $course->time = $this->getCourseTime($course->episodes->pluck('time')); $course->save(); } Model…

VIEW QUESTION

fromJSON method not being called in Flutter

I am trying to call this method but TempReceiptModel.fromJSON is not being called. Future<TempReceiptModel?> getTempReceipt({ required UserModel? user, }) async { TempReceiptModel? tempReceipt; try { // print(tempReceipt.) SharedPreferences prefs = await SharedPreferences.getInstance(); String? accessToken = prefs.getString('accesstoken'); String? userID = user?.user_id;…

VIEW QUESTION
Back To Top
Search