Though I will always have a passion for
PCB design and product prototyping,
I currently work as a Software engineer.
1<?php
2
3namespaceApp\Models;
4
5useIlluminate\Database\Eloquent\Factories\HasFactory;
6useIlluminate\Database\Eloquent\Model;
7
8classYoutubeListextendsModel
9{
10....useHasFactory;
11
12....protected$guarded =[];
13....protected$casts =[
14........'settings'=>'json',
15....];
16
17....publicfunctionuser()
18....{
19........return$this->belongsTo(User::class);
20....}
21
22....publicfunctionvideos()
23....{
24........return$this->belongsToMany(YoutubeVideo::class,'youtube_video_list')
25............->withPivot(YoutubeVideo::YOUTUBE_LIST_PIVOT)
26............->orderBy('order');
27....}
28
29....publicfunctionnextIndex():int
30....{
31........if(empty($this->max_index)){
32............$this->max_index =($this->videos()->max('index')??0)+1;
33........}
34
35........return$this->max_index +1;
36....}
37}
Yes, I have used Vue on this site.
No, I don't like using Vue.