Initial commit
This commit is contained in:
commit
c909d539bc
7178 files changed
+756624
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Models\Course;
|
||||
use App\Models\Chapter;
|
||||
use App\Models\Lesson;
|
||||
use App\Models\LessonSection;
|
||||
|
||||
class RouteBindingServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
Route::bind('course', function ($value) {
|
||||
return \App\Models\Course::where('slug', $value)->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('lesson', function ($value) {
|
||||
return \App\Models\Lesson::where('slug', $value)->firstOrFail();
|
||||
});
|
||||
|
||||
Route::bind('chapter', function ($value) {
|
||||
return \App\Models\Chapter::where('slug', $value)->firstOrFail();
|
||||
});
|
||||
|
||||
|
||||
Route::bind('section', function ($value) {
|
||||
return LessonSection::where('slug', $value)->firstOrFail();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user