skip to Main Content

Model not parsing from json/map in flutter

I have this function to get userData into model: Future<UserModel> getUser() async { final snap = await _fireStore .collection("users") .doc(_firebaseAuth.currentUser?.email ?? _firebaseAuth.currentUser?.phoneNumber) .get(); final data = snap.data(); debugPrint("data: $data"); // this line gives output // debugPrint("data: ${jsonDecode(data.toString())}"); -> this line…

VIEW QUESTION

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
Back To Top
Search