tutorumdev
12/22/2021, 10:14 AMifox
12/22/2021, 10:21 AMkalle
12/22/2021, 10:26 AMphp
Route::get('/{twillslug}', 'CustomController@index');
php
// CustomController.php
use App\Models\Model;
public function index($twillslug)
{
// I assume that slug is named slug in Twill
$post = Model::where('slug', $twillslug)
->firstOrFail();
}
Its basic Laravel. Here it will return 404 if not found slug.tutorumdev
12/22/2021, 10:28 AM$journey = $this->repository->forSlug($id);
abort_unless($journey, 404, 'Journey');ifox
12/22/2021, 10:33 AMJourney::find(1)ifox
12/22/2021, 10:33 AMifox
12/22/2021, 10:33 AMifox
12/22/2021, 10:34 AMtutorumdev
12/22/2021, 10:46 AMprotected $relatedBrowsers = ['clients']; where would this go (which is in the repository) if i just query per normal?ifox
12/22/2021, 10:47 AM->getRelated('clients')tutorumdev
12/22/2021, 10:59 AMtutorumdev
12/22/2021, 11:01 AMifox
12/22/2021, 11:03 AMApp\Models\Journeyifox
12/22/2021, 11:04 AMApp\Models\Journey and App\Journey?tutorumdev
12/22/2021, 11:07 AMApp\Journey, when I put App\Models\Journey it throws this:ifox
12/22/2021, 11:07 AMifox
12/22/2021, 11:08 AMtutorumdev
12/22/2021, 11:08 AMifox
12/22/2021, 11:09 AMtutorumdev
12/22/2021, 11:10 AMclass Journey extends Model
{
protected $table = 'journey_translations';
protected $primaryKey = 'id';
public function client(){
return $this->belongsTo('App\Client');
}
public function category(){
return $this->belongsTo('App\Category');
}
}ifox
12/22/2021, 11:10 AMifox
12/22/2021, 11:11 AMtutorumdev
12/22/2021, 11:14 AMifox
12/22/2021, 12:26 PMtutorumdev
12/22/2021, 12:52 PMtutorumdev
12/22/2021, 12:54 PMSebastianpusch
12/22/2021, 1:05 PMkalle
12/22/2021, 1:08 PMSebastianpusch
12/22/2021, 1:10 PMSebastianpusch
12/22/2021, 1:11 PM