repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Like.php
app/Like.php
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Like extends Model { public function user() { return $this->belongsTo('App\User'); } public function post() { return $this->belongsTo('App\Post'); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Post.php
app/Post.php
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Post extends Model { public function user() { return $this->belongsTo('App\User'); } public function likes() { return $this->hasMany('App\Like'); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Jobs/Job.php
app/Jobs/Job.php
<?php namespace App\Jobs; use Illuminate\Bus\Queueable; abstract class Job { /* |-------------------------------------------------------------------------- | Queueable Jobs |-------------------------------------------------------------------------- | | This job base class provides a central location to place any logic that | is shared across all of your jobs. The trait included with the class | provides access to the "onQueue" and "delay" queue helper methods. | */ use Queueable; }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Exceptions/Handler.php
app/Exceptions/Handler.php
<?php namespace App\Exceptions; use Exception; use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Database\Eloquent\ModelNotFoundException; use Symfony\Component\HttpKernel\Exception\HttpException; use Illuminate\Foundation\Validation\ValidationException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler { /** * A list of the exception types that should not be reported. * * @var array */ protected $dontReport = [ AuthorizationException::class, HttpException::class, ModelNotFoundException::class, ValidationException::class, ]; /** * Report or log an exception. * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * * @param \Exception $e * @return void */ public function report(Exception $e) { return parent::report($e); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $e * @return \Illuminate\Http\Response */ public function render($request, Exception $e) { return parent::render($request, $e); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/routes.php
app/Http/routes.php
<?php /* |-------------------------------------------------------------------------- | Routes File |-------------------------------------------------------------------------- | | Here is where you will register all of the routes in an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. | */ Route::get('/', function () { return view('welcome'); })->name('home'); Route::post('/signup', [ 'uses' => 'UserController@postSignUp', 'as' => 'signup' ]); Route::post('/signin', [ 'uses' => 'UserController@postSignIn', 'as' => 'signin' ]); Route::get('/logout', [ 'uses' => 'UserController@getLogout', 'as' => 'logout' ]); Route::get('/account', [ 'uses' => 'UserController@getAccount', 'as' => 'account' ]); Route::post('/upateaccount', [ 'uses' => 'UserController@postSaveAccount', 'as' => 'account.save' ]); Route::get('/userimage/{filename}', [ 'uses' => 'UserController@getUserImage', 'as' => 'account.image' ]); Route::get('/dashboard', [ 'uses' => 'PostController@getDashboard', 'as' => 'dashboard', 'middleware' => 'auth' ]); Route::post('/createpost', [ 'uses' => 'PostController@postCreatePost', 'as' => 'post.create', 'middleware' => 'auth' ]); Route::get('/delete-post/{post_id}', [ 'uses' => 'PostController@getDeletePost', 'as' => 'post.delete', 'middleware' => 'auth' ]); Route::post('/edit', [ 'uses' => 'PostController@postEditPost', 'as' => 'edit' ]); Route::post('/like', [ 'uses' => 'PostController@postLikePost', 'as' => 'like' ]);
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Kernel.php
app/Http/Kernel.php
<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, ]; /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, ], 'api' => [ 'throttle:60,1', ], ]; /** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, ]; }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Requests/Request.php
app/Http/Requests/Request.php
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; abstract class Request extends FormRequest { // }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Controllers/PostController.php
app/Http/Controllers/PostController.php
<?php namespace App\Http\Controllers; use App\Like; use App\Post; use Illuminate\Support\Facades\Auth; use Illuminate\Http\Request; use Illuminate\Support\Facades\Session; class PostController extends Controller { public function getDashboard() { $posts = Post::orderBy('created_at', 'desc')->get(); return view('dashboard', ['posts' => $posts]); } public function postCreatePost(Request $request) { $this->validate($request, [ 'body' => 'required|max:1000' ]); $post = new Post(); $post->body = $request['body']; $message = 'There was an error'; if ($request->user()->posts()->save($post)) { $message = 'Post successfully created!'; } return redirect()->route('dashboard')->with(['message' => $message]); } public function getDeletePost($post_id) { $post = Post::where('id', $post_id)->first(); if (Auth::user() != $post->user) { return redirect()->back(); } $post->delete(); return redirect()->route('dashboard')->with(['message' => 'Successfully deleted!']); } public function postEditPost(Request $request) { $this->validate($request, [ 'body' => 'required' ]); $post = Post::find($request['postId']); if (Auth::user() != $post->user) { return redirect()->back(); } $post->body = $request['body']; $post->update(); return response()->json(['new_body' => $post->body], 200); } public function postLikePost(Request $request) { $post_id = $request['postId']; $is_like = $request['isLike'] === 'true'; $update = false; $post = Post::find($post_id); if (!$post) { return null; } $user = Auth::user(); $like = $user->likes()->where('post_id', $post_id)->first(); if ($like) { $already_like = $like->like; $update = true; if ($already_like == $is_like) { $like->delete(); return null; } } else { $like = new Like(); } $like->like = $is_like; $like->user_id = $user->id; $like->post_id = $post->id; if ($update) { $like->update(); } else { $like->save(); } return null; } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Controllers/Controller.php
app/Http/Controllers/Controller.php
<?php namespace App\Http\Controllers; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Controllers/UserController.php
app/Http/Controllers/UserController.php
<?php namespace App\Http\Controllers; use App\User; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Storage; class UserController extends Controller { public function postSignUp(Request $request) { $this->validate($request, [ 'email' => 'required|email|unique:users', 'first_name' => 'required|max:120', 'password' => 'required|min:4' ]); $email = $request['email']; $first_name = $request['first_name']; $password = bcrypt($request['password']); $user = new User(); $user->email = $email; $user->first_name = $first_name; $user->password = $password; $user->save(); Auth::login($user); return redirect()->route('dashboard'); } public function postSignIn(Request $request) { $this->validate($request, [ 'email' => 'required', 'password' => 'required' ]); if (Auth::attempt(['email' => $request['email'], 'password' => $request['password']])) { return redirect()->route('dashboard'); } return redirect()->back(); } public function getLogout() { Auth::logout(); return redirect()->route('home'); } public function getAccount() { return view('account', ['user' => Auth::user()]); } public function postSaveAccount(Request $request) { $this->validate($request, [ 'first_name' => 'required|max:120' ]); $user = Auth::user(); $old_name = $user->first_name; $user->first_name = $request['first_name']; $user->update(); $file = $request->file('image'); $filename = $request['first_name'] . '-' . $user->id . '.jpg'; $old_filename = $old_name . '-' . $user->id . '.jpg'; $update = false; if (Storage::disk('local')->has($old_filename)) { $old_file = Storage::disk('local')->get($old_filename); Storage::disk('local')->put($filename, $old_file); $update = true; } if ($file) { Storage::disk('local')->put($filename, File::get($file)); } if ($update && $old_filename !== $filename) { Storage::delete($old_filename); } return redirect()->route('account'); } public function getUserImage($filename) { $file = Storage::disk('local')->get($filename); return new Response($file, 200); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Middleware/Authenticate.php
app/Http/Middleware/Authenticate.php
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Auth; class Authenticate { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return redirect()->route('home'); } } return $next($request); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Middleware/RedirectIfAuthenticated.php
app/Http/Middleware/RedirectIfAuthenticated.php
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/'); } return $next($request); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Middleware/EncryptCookies.php
app/Http/Middleware/EncryptCookies.php
<?php namespace App\Http\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter; class EncryptCookies extends BaseEncrypter { /** * The names of the cookies that should not be encrypted. * * @var array */ protected $except = [ // ]; }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Http/Middleware/VerifyCsrfToken.php
app/Http/Middleware/VerifyCsrfToken.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; class VerifyCsrfToken extends BaseVerifier { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ // ]; }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Console/Kernel.php
app/Console/Kernel.php
<?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ Commands\Inspire::class, ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('inspire') ->hourly(); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Console/Commands/Inspire.php
app/Console/Commands/Inspire.php
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Foundation\Inspiring; class Inspire extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'inspire'; /** * The console command description. * * @var string */ protected $description = 'Display an inspiring quote'; /** * Execute the console command. * * @return mixed */ public function handle() { $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Providers/RouteServiceProvider.php
app/Providers/RouteServiceProvider.php
<?php namespace App\Providers; use Illuminate\Routing\Router; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; class RouteServiceProvider extends ServiceProvider { /** * This namespace is applied to the controller routes in your routes file. * * In addition, it is set as the URL generator's root namespace. * * @var string */ protected $namespace = 'App\Http\Controllers'; /** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { // parent::boot($router); } /** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * @return void */ public function map(Router $router) { $router->group([ 'namespace' => $this->namespace, 'middleware' => 'web', ], function ($router) { require app_path('Http/routes.php'); }); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Providers/EventServiceProvider.php
app/Providers/EventServiceProvider.php
<?php namespace App\Providers; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider { /** * The event listener mappings for the application. * * @var array */ protected $listen = [ 'App\Events\SomeEvent' => [ 'App\Listeners\EventListener', ], ]; /** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); // } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Providers/AppServiceProvider.php
app/Providers/AppServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { // } /** * Register any application services. * * @return void */ public function register() { // } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Providers/AuthServiceProvider.php
app/Providers/AuthServiceProvider.php
<?php namespace App\Providers; use Illuminate\Contracts\Auth\Access\Gate as GateContract; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any application authentication / authorization services. * * @param \Illuminate\Contracts\Auth\Access\Gate $gate * @return void */ public function boot(GateContract $gate) { $this->registerPolicies($gate); // } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/app/Events/Event.php
app/Events/Event.php
<?php namespace App\Events; abstract class Event { // }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/bootstrap/app.php
bootstrap/app.php
<?php /* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | | The first thing we will do is create a new Laravel application instance | which serves as the "glue" for all the components of Laravel, and is | the IoC container for the system binding all of the various parts. | */ $app = new Illuminate\Foundation\Application( realpath(__DIR__.'/../') ); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton( Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class ); $app->singleton( Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class ); $app->singleton( Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class ); /* |-------------------------------------------------------------------------- | Return The Application |-------------------------------------------------------------------------- | | This script returns the application instance. The instance is given to | the calling script so we can separate the building of the instances | from the actual running of the application and sending responses. | */ return $app;
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/bootstrap/autoload.php
bootstrap/autoload.php
<?php define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Composer Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader | for our application. We just need to utilize it! We'll require it | into the script here so that we do not have to worry about the | loading of any our classes "manually". Feels great to relax. | */ require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Include The Compiled Class File |-------------------------------------------------------------------------- | | To dramatically increase your application's performance, you may use a | compiled class file which contains all of the classes commonly used | by a request. The Artisan "optimize" is used to create this file. | */ $compiledPath = __DIR__.'/cache/compiled.php'; if (file_exists($compiledPath)) { require $compiledPath; }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/tests/TestCase.php
tests/TestCase.php
<?php class TestCase extends Illuminate\Foundation\Testing\TestCase { /** * The base URL to use while testing the application. * * @var string */ protected $baseUrl = 'http://localhost'; /** * Creates the application. * * @return \Illuminate\Foundation\Application */ public function createApplication() { $app = require __DIR__.'/../bootstrap/app.php'; $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); return $app; } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/tests/ExampleTest.php
tests/ExampleTest.php
<?php use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseTransactions; class ExampleTest extends TestCase { /** * A basic functional test example. * * @return void */ public function testBasicExample() { $this->visit('/') ->see('Laravel 5'); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/public/index.php
public/index.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylorotwell@gmail.com> */ /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels nice to relax. | */ require __DIR__.'/../bootstrap/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__.'/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response);
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/app.php
config/app.php
<?php return [ /* |-------------------------------------------------------------------------- | Application Environment |-------------------------------------------------------------------------- | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various | services your application utilizes. Set this in your ".env" file. | */ 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- | | When your application is in debug mode, detailed error messages with | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | */ 'debug' => env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- | Application URL |-------------------------------------------------------------------------- | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of | your application so that it is used when running Artisan tasks. | */ 'url' => 'http://localhost', /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | */ 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- | Application Locale Configuration |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used | by the translation service provider. You are free to set this value | to any of the locales which will be supported by the application. | */ 'locale' => 'en', /* |-------------------------------------------------------------------------- | Application Fallback Locale |-------------------------------------------------------------------------- | | The fallback locale determines the locale to use when the current one | is not available. You may change the value to correspond to any of | the language folders that are provided through your application. | */ 'fallback_locale' => 'en', /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | This key is used by the Illuminate encrypter service and should be set | to a random, 32 character string, otherwise these encrypted strings | will not be safe. Please do this before deploying an application! | */ 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- | Logging Configuration |-------------------------------------------------------------------------- | | Here you may configure the log settings for your application. Out of | the box, Laravel uses the Monolog PHP logging library. This gives | you a variety of powerful log handlers / formatters to utilize. | | Available Settings: "single", "daily", "syslog", "errorlog" | */ 'log' => env('APP_LOG', 'single'), /* |-------------------------------------------------------------------------- | Autoloaded Service Providers |-------------------------------------------------------------------------- | | The service providers listed here will be automatically loaded on the | request to your application. Feel free to add your own services to | this array to grant expanded functionality to your applications. | */ 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, Illuminate\Cache\CacheServiceProvider::class, Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, Illuminate\Cookie\CookieServiceProvider::class, Illuminate\Database\DatabaseServiceProvider::class, Illuminate\Encryption\EncryptionServiceProvider::class, Illuminate\Filesystem\FilesystemServiceProvider::class, Illuminate\Foundation\Providers\FoundationServiceProvider::class, Illuminate\Hashing\HashServiceProvider::class, Illuminate\Mail\MailServiceProvider::class, Illuminate\Pagination\PaginationServiceProvider::class, Illuminate\Pipeline\PipelineServiceProvider::class, Illuminate\Queue\QueueServiceProvider::class, Illuminate\Redis\RedisServiceProvider::class, Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, Illuminate\Session\SessionServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, ], /* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, 'Auth' => Illuminate\Support\Facades\Auth::class, 'Blade' => Illuminate\Support\Facades\Blade::class, 'Cache' => Illuminate\Support\Facades\Cache::class, 'Config' => Illuminate\Support\Facades\Config::class, 'Cookie' => Illuminate\Support\Facades\Cookie::class, 'Crypt' => Illuminate\Support\Facades\Crypt::class, 'DB' => Illuminate\Support\Facades\DB::class, 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 'Event' => Illuminate\Support\Facades\Event::class, 'File' => Illuminate\Support\Facades\File::class, 'Gate' => Illuminate\Support\Facades\Gate::class, 'Hash' => Illuminate\Support\Facades\Hash::class, 'Lang' => Illuminate\Support\Facades\Lang::class, 'Log' => Illuminate\Support\Facades\Log::class, 'Mail' => Illuminate\Support\Facades\Mail::class, 'Password' => Illuminate\Support\Facades\Password::class, 'Queue' => Illuminate\Support\Facades\Queue::class, 'Redirect' => Illuminate\Support\Facades\Redirect::class, 'Redis' => Illuminate\Support\Facades\Redis::class, 'Request' => Illuminate\Support\Facades\Request::class, 'Response' => Illuminate\Support\Facades\Response::class, 'Route' => Illuminate\Support\Facades\Route::class, 'Schema' => Illuminate\Support\Facades\Schema::class, 'Session' => Illuminate\Support\Facades\Session::class, 'Storage' => Illuminate\Support\Facades\Storage::class, 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/session.php
config/session.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Session Driver |-------------------------------------------------------------------------- | | This option controls the default session "driver" that will be used on | requests. By default, we will use the lightweight native driver but | you may specify any of the other wonderful drivers provided here. | | Supported: "file", "cookie", "database", "apc", | "memcached", "redis", "array" | */ 'driver' => env('SESSION_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | */ 'lifetime' => 120, 'expire_on_close' => false, /* |-------------------------------------------------------------------------- | Session Encryption |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data | should be encrypted before it is stored. All encryption will be run | automatically by Laravel and you can use the Session like normal. | */ 'encrypt' => false, /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | | When using the native session driver, we need a location where session | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | */ 'files' => storage_path('framework/sessions'), /* |-------------------------------------------------------------------------- | Session Database Connection |-------------------------------------------------------------------------- | | When using the "database" or "redis" session drivers, you may specify a | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | */ 'connection' => null, /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | | When using the "database" session driver, you may specify the table we | should use to manage the sessions. Of course, a sensible default is | provided for you; however, you are free to change this as needed. | */ 'table' => 'sessions', /* |-------------------------------------------------------------------------- | Session Sweeping Lottery |-------------------------------------------------------------------------- | | Some session drivers must manually sweep their storage location to get | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | */ 'lottery' => [2, 100], /* |-------------------------------------------------------------------------- | Session Cookie Name |-------------------------------------------------------------------------- | | Here you may change the name of the cookie used to identify a session | instance by ID. The name specified here will get used every time a | new session cookie is created by the framework for every driver. | */ 'cookie' => 'laravel_session', /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | */ 'path' => '/', /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | | Here you may change the domain of the cookie used to identify a session | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | */ 'domain' => null, /* |-------------------------------------------------------------------------- | HTTPS Only Cookies |-------------------------------------------------------------------------- | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you if it can not be done securely. | */ 'secure' => false, ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/queue.php
config/queue.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Queue Driver |-------------------------------------------------------------------------- | | The Laravel queue API supports a variety of back-ends via an unified | API, giving you convenient access to each back-end using the same | syntax for each one. Here you may set the default queue driver. | | Supported: "null", "sync", "database", "beanstalkd", | "sqs", "redis" | */ 'default' => env('QUEUE_DRIVER', 'sync'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | | Here you may configure the connection information for each server that | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | */ 'connections' => [ 'sync' => [ 'driver' => 'sync', ], 'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', 'expire' => 60, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', 'ttr' => 60, ], 'sqs' => [ 'driver' => 'sqs', 'key' => 'your-public-key', 'secret' => 'your-secret-key', 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', 'queue' => 'your-queue-name', 'region' => 'us-east-1', ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', 'queue' => 'default', 'expire' => 60, ], ], /* |-------------------------------------------------------------------------- | Failed Queue Jobs |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you | can control which database and table are used to store the jobs that | have failed. You may change them to any database / table you wish. | */ 'failed' => [ 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/cache.php
config/cache.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Cache Store |-------------------------------------------------------------------------- | | This option controls the default cache connection that gets used while | using this caching library. This connection is used when another is | not explicitly specified when executing a given caching function. | */ 'default' => env('CACHE_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Cache Stores |-------------------------------------------------------------------------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | */ 'stores' => [ 'apc' => [ 'driver' => 'apc', ], 'array' => [ 'driver' => 'array', ], 'database' => [ 'driver' => 'database', 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache'), ], 'memcached' => [ 'driver' => 'memcached', 'servers' => [ [ 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100, ], ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], ], /* |-------------------------------------------------------------------------- | Cache Key Prefix |-------------------------------------------------------------------------- | | When utilizing a RAM based store such as APC or Memcached, there might | be other applications utilizing the same cache. So, we'll specify a | value to get prefixed to all our keys so we can avoid collisions. | */ 'prefix' => 'laravel', ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/view.php
config/view.php
<?php return [ /* |-------------------------------------------------------------------------- | View Storage Paths |-------------------------------------------------------------------------- | | Most templating systems load templates from disk. Here you may specify | an array of paths that should be checked for your views. Of course | the usual Laravel view path has already been registered for you. | */ 'paths' => [ realpath(base_path('resources/views')), ], /* |-------------------------------------------------------------------------- | Compiled View Path |-------------------------------------------------------------------------- | | This option determines where all the compiled Blade templates will be | stored for your application. Typically, this is within the storage | directory. However, as usual, you are free to change this value. | */ 'compiled' => realpath(storage_path('framework/views')), ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/database.php
config/database.php
<?php return [ /* |-------------------------------------------------------------------------- | PDO Fetch Style |-------------------------------------------------------------------------- | | By default, database results will be returned as instances of the PHP | stdClass object; however, you may desire to retrieve records in an | array format for simplicity. Here you can tweak the fetch style. | */ 'fetch' => PDO::FETCH_CLASS, /* |-------------------------------------------------------------------------- | Default Database Connection Name |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish | to use as your default connection for all database work. Of course | you may use many connections at once using the Database library. | */ 'default' => env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | | Here are each of the database connections setup for your application. | Of course, examples of configuring each database platform that is | supported by Laravel is shown below to make development simple. | | | All database work in Laravel is done through the PHP PDO facilities | so make sure you have the driver for your particular database of | choice installed on your machine before you begin development. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => database_path('database.sqlite'), 'prefix' => '', ], 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, ], 'pgsql' => [ 'driver' => 'pgsql', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', ], 'sqlsrv' => [ 'driver' => 'sqlsrv', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', ], ], /* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run in the database. | */ 'migrations' => 'migrations', /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer set of commands than a typical key-value systems | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ 'cluster' => false, 'default' => [ 'host' => env('REDIS_HOST', 'localhost'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/services.php
config/services.php
<?php return [ /* |-------------------------------------------------------------------------- | Third Party Services |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such | as Stripe, Mailgun, Mandrill, and others. This file provides a sane | default location for this type of information, allowing packages | to have a conventional place to find your various credentials. | */ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), ], 'mandrill' => [ 'secret' => env('MANDRILL_SECRET'), ], 'ses' => [ 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), 'region' => 'us-east-1', ], 'stripe' => [ 'model' => App\User::class, 'key' => env('STRIPE_KEY'), 'secret' => env('STRIPE_SECRET'), ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/filesystems.php
config/filesystems.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Filesystem Disk |-------------------------------------------------------------------------- | | Here you may specify the default filesystem disk that should be used | by the framework. A "local" driver, as well as a variety of cloud | based drivers are available for your choosing. Just store away! | | Supported: "local", "ftp", "s3", "rackspace" | */ 'default' => 'local', /* |-------------------------------------------------------------------------- | Default Cloud Filesystem Disk |-------------------------------------------------------------------------- | | Many applications store files both locally and in the cloud. For this | reason, you may specify a default "cloud" driver here. This driver | will be bound as the Cloud disk implementation in the container. | */ 'cloud' => 's3', /* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | */ 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'ftp' => [ 'driver' => 'ftp', 'host' => 'ftp.example.com', 'username' => 'your-username', 'password' => 'your-password', // Optional FTP Settings... // 'port' => 21, // 'root' => '', // 'passive' => true, // 'ssl' => true, // 'timeout' => 30, ], 's3' => [ 'driver' => 's3', 'key' => 'your-key', 'secret' => 'your-secret', 'region' => 'your-region', 'bucket' => 'your-bucket', ], 'rackspace' => [ 'driver' => 'rackspace', 'username' => 'your-username', 'key' => 'your-key', 'container' => 'your-container', 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', 'region' => 'IAD', 'url_type' => 'publicURL', ], ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/mail.php
config/mail.php
<?php return [ /* |-------------------------------------------------------------------------- | Mail Driver |-------------------------------------------------------------------------- | | Laravel supports both SMTP and PHP's "mail" function as drivers for the | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log" | */ 'driver' => env('MAIL_DRIVER', 'smtp'), /* |-------------------------------------------------------------------------- | SMTP Host Address |-------------------------------------------------------------------------- | | Here you may provide the host address of the SMTP server used by your | applications. A default option is provided that is compatible with | the Mailgun mail service which will provide reliable deliveries. | */ 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), /* |-------------------------------------------------------------------------- | SMTP Host Port |-------------------------------------------------------------------------- | | This is the SMTP port used by your application to deliver e-mails to | users of the application. Like the host we have set this value to | stay compatible with the Mailgun e-mail application by default. | */ 'port' => env('MAIL_PORT', 587), /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all e-mails sent by your application to be sent from | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | */ 'from' => ['address' => null, 'name' => null], /* |-------------------------------------------------------------------------- | E-Mail Encryption Protocol |-------------------------------------------------------------------------- | | Here you may specify the encryption protocol that should be used when | the application send e-mail messages. A sensible default using the | transport layer security protocol should provide great security. | */ 'encryption' => env('MAIL_ENCRYPTION', 'tls'), /* |-------------------------------------------------------------------------- | SMTP Server Username |-------------------------------------------------------------------------- | | If your SMTP server requires a username for authentication, you should | set it here. This will get used to authenticate with your server on | connection. You may also set the "password" value below this one. | */ 'username' => env('MAIL_USERNAME'), /* |-------------------------------------------------------------------------- | SMTP Server Password |-------------------------------------------------------------------------- | | Here you may set the password required by your SMTP server to send out | messages from your application. This will be given to the server on | connection so that the application will be able to send messages. | */ 'password' => env('MAIL_PASSWORD'), /* |-------------------------------------------------------------------------- | Sendmail System Path |-------------------------------------------------------------------------- | | When using the "sendmail" driver to send e-mails, we will need to know | the path to where Sendmail lives on this server. A default path has | been provided here, which will work well on most of your systems. | */ 'sendmail' => '/usr/sbin/sendmail -bs', ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/compile.php
config/compile.php
<?php return [ /* |-------------------------------------------------------------------------- | Additional Compiled Classes |-------------------------------------------------------------------------- | | Here you may specify additional classes to include in the compiled file | generated by the `artisan optimize` command. These should be classes | that are included on basically every request into the application. | */ 'files' => [ // ], /* |-------------------------------------------------------------------------- | Compiled File Providers |-------------------------------------------------------------------------- | | Here you may list service providers which define a "compiles" function | that returns additional files that should be compiled, providing an | easy way to get common files from any packages you are utilizing. | */ 'providers' => [ // ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/broadcasting.php
config/broadcasting.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Broadcaster |-------------------------------------------------------------------------- | | This option controls the default broadcaster that will be used by the | framework when an event needs to be broadcast. You may set this to | any of the connections defined in the "connections" array below. | */ 'default' => env('BROADCAST_DRIVER', 'pusher'), /* |-------------------------------------------------------------------------- | Broadcast Connections |-------------------------------------------------------------------------- | | Here you may define all of the broadcast connections that will be used | to broadcast events to other systems or over websockets. Samples of | each available type of connection are provided inside this array. | */ 'connections' => [ 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_KEY'), 'secret' => env('PUSHER_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ // ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], 'log' => [ 'driver' => 'log', ], ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/config/auth.php
config/auth.php
<?php return [ /* |-------------------------------------------------------------------------- | Authentication Defaults |-------------------------------------------------------------------------- | | This option controls the default authentication "guard" and password | reset options for your application. You may change these defaults | as required, but they're a perfect start for most applications. | */ 'defaults' => [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | Here you may set the options for resetting passwords including the view | that is your password reset e-mail. You may also set the name of the | table that maintains all of the reset tokens for your application. | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'email' => 'auth.emails.password', 'table' => 'password_resets', 'expire' => 60, ], ], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/database/seeds/DatabaseSeeder.php
database/seeds/DatabaseSeeder.php
<?php use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // $this->call(UserTableSeeder::class); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/database/factories/ModelFactory.php
database/factories/ModelFactory.php
<?php /* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | Here you may define all of your model factories. Model factories give | you a convenient way to create models for testing and seeding your | database. Just tell the factory how a default model should look. | */ $factory->define(App\User::class, function (Faker\Generator $faker) { return [ 'name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10), ]; });
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/database/migrations/2016_03_15_093359_create_likes_table.php
database/migrations/2016_03_15_093359_create_likes_table.php
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateLikesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('likes', function (Blueprint $table) { $table->increments('id'); $table->timestamps(); $table->integer('user_id'); $table->integer('post_id'); $table->boolean('like'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('likes'); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/database/migrations/2016_02_12_120658_create_posts_table.php
database/migrations/2016_02_12_120658_create_posts_table.php
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePostsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('posts', function (Blueprint $table) { $table->increments('id'); $table->timestamps(); $table->text('body'); $table->integer('user_id'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('posts'); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/database/migrations/2016_01_28_094202_create_users_table.php
database/migrations/2016_01_28_094202_create_users_table.php
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->timestamps(); $table->string('email'); $table->string('first_name'); $table->string('password'); $table->rememberToken(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('users'); } }
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/lang/en/passwords.php
resources/lang/en/passwords.php
<?php return [ /* |-------------------------------------------------------------------------- | Password Reset Language Lines |-------------------------------------------------------------------------- | | The following language lines are the default lines which match reasons | that are given by the password broker for a password update attempt | has failed, such as for an invalid token or invalid new password. | */ 'password' => 'Passwords must be at least six characters and match the confirmation.', 'reset' => 'Your password has been reset!', 'sent' => 'We have e-mailed your password reset link!', 'token' => 'This password reset token is invalid.', 'user' => "We can't find a user with that e-mail address.", ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/lang/en/pagination.php
resources/lang/en/pagination.php
<?php return [ /* |-------------------------------------------------------------------------- | Pagination Language Lines |-------------------------------------------------------------------------- | | The following language lines are used by the paginator library to build | the simple pagination links. You are free to change them to anything | you want to customize your views to better match your application. | */ 'previous' => '&laquo; Previous', 'next' => 'Next &raquo;', ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/lang/en/validation.php
resources/lang/en/validation.php
<?php return [ /* |-------------------------------------------------------------------------- | Validation Language Lines |-------------------------------------------------------------------------- | | The following language lines contain the default error messages used by | the validator class. Some of these rules have multiple versions such | as the size rules. Feel free to tweak each of these messages here. | */ 'accepted' => 'The :attribute must be accepted.', 'active_url' => 'The :attribute is not a valid URL.', 'after' => 'The :attribute must be a date after :date.', 'alpha' => 'The :attribute may only contain letters.', 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', 'alpha_num' => 'The :attribute may only contain letters and numbers.', 'array' => 'The :attribute must be an array.', 'before' => 'The :attribute must be a date before :date.', 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', 'file' => 'The :attribute must be between :min and :max kilobytes.', 'string' => 'The :attribute must be between :min and :max characters.', 'array' => 'The :attribute must have between :min and :max items.', ], 'boolean' => 'The :attribute field must be true or false.', 'confirmed' => 'The :attribute confirmation does not match.', 'date' => 'The :attribute is not a valid date.', 'date_format' => 'The :attribute does not match the format :format.', 'different' => 'The :attribute and :other must be different.', 'digits' => 'The :attribute must be :digits digits.', 'digits_between' => 'The :attribute must be between :min and :max digits.', 'email' => 'The :attribute must be a valid email address.', 'exists' => 'The selected :attribute is invalid.', 'filled' => 'The :attribute field is required.', 'image' => 'The :attribute must be an image.', 'in' => 'The selected :attribute is invalid.', 'integer' => 'The :attribute must be an integer.', 'ip' => 'The :attribute must be a valid IP address.', 'json' => 'The :attribute must be a valid JSON string.', 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', 'file' => 'The :attribute may not be greater than :max kilobytes.', 'string' => 'The :attribute may not be greater than :max characters.', 'array' => 'The :attribute may not have more than :max items.', ], 'mimes' => 'The :attribute must be a file of type: :values.', 'min' => [ 'numeric' => 'The :attribute must be at least :min.', 'file' => 'The :attribute must be at least :min kilobytes.', 'string' => 'The :attribute must be at least :min characters.', 'array' => 'The :attribute must have at least :min items.', ], 'not_in' => 'The selected :attribute is invalid.', 'numeric' => 'The :attribute must be a number.', 'regex' => 'The :attribute format is invalid.', 'required' => 'The :attribute field is required.', 'required_if' => 'The :attribute field is required when :other is :value.', 'required_unless' => 'The :attribute field is required unless :other is in :values.', 'required_with' => 'The :attribute field is required when :values is present.', 'required_with_all' => 'The :attribute field is required when :values is present.', 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', 'same' => 'The :attribute and :other must match.', 'size' => [ 'numeric' => 'The :attribute must be :size.', 'file' => 'The :attribute must be :size kilobytes.', 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', ], 'string' => 'The :attribute must be a string.', 'timezone' => 'The :attribute must be a valid zone.', 'unique' => 'The :attribute has already been taken.', 'url' => 'The :attribute format is invalid.', /* |-------------------------------------------------------------------------- | Custom Validation Language Lines |-------------------------------------------------------------------------- | | Here you may specify custom validation messages for attributes using the | convention "attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'custom' => [ 'attribute-name' => [ 'rule-name' => 'custom-message', ], ], /* |-------------------------------------------------------------------------- | Custom Validation Attributes |-------------------------------------------------------------------------- | | The following language lines are used to swap attribute place-holders | with something more reader friendly such as E-Mail Address instead | of "email". This simply helps us make messages a little cleaner. | */ 'attributes' => [], ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/lang/en/auth.php
resources/lang/en/auth.php
<?php return [ /* |-------------------------------------------------------------------------- | Authentication Language Lines |-------------------------------------------------------------------------- | | The following language lines are used during authentication for various | messages that we need to display to the user. You are free to modify | these language lines according to your application's requirements. | */ 'failed' => 'These credentials do not match our records.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ];
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/welcome.blade.php
resources/views/welcome.blade.php
@extends('layouts.master') @section('title') Welcome! @endsection @section('content') @include('includes.message-block') <div class="row"> <div class="col-md-6"> <h3>Sign Up</h3> <form action="{{ route('signup') }}" method="post"> <div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}"> <label for="email">Your E-Mail</label> <input class="form-control" type="text" name="email" id="email" value="{{ Request::old('email') }}"> </div> <div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}"> <label for="first_name">Your First Name</label> <input class="form-control" type="text" name="first_name" id="first_name" value="{{ Request::old('first_name') }}"> </div> <div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}"> <label for="password">Your Password</label> <input class="form-control" type="password" name="password" id="password" value="{{ Request::old('password') }}"> </div> <button type="submit" class="btn btn-primary">Submit</button> <input type="hidden" name="_token" value="{{ Session::token() }}"> </form> </div> <div class="col-md-6"> <h3>Sign In</h3> <form action="{{ route('signin') }}" method="post"> <div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}"> <label for="email">Your E-Mail</label> <input class="form-control" type="text" name="email" id="email" value="{{ Request::old('email') }}"> </div> <div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}"> <label for="password">Your Password</label> <input class="form-control" type="password" name="password" id="password" value="{{ Request::old('password') }}"> </div> <button type="submit" class="btn btn-primary">Submit</button> <input type="hidden" name="_token" value="{{ Session::token() }}"> </form> </div> </div> @endsection
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/dashboard.blade.php
resources/views/dashboard.blade.php
@extends('layouts.master') @section('content') @include('includes.message-block') <section class="row new-post"> <div class="col-md-6 col-md-offset-3"> <header><h3>What do you have to say?</h3></header> <form action="{{ route('post.create') }}" method="post"> <div class="form-group"> <textarea class="form-control" name="body" id="new-post" rows="5" placeholder="Your Post"></textarea> </div> <button type="submit" class="btn btn-primary">Create Post</button> <input type="hidden" value="{{ Session::token() }}" name="_token"> </form> </div> </section> <section class="row posts"> <div class="col-md-6 col-md-offset-3"> <header><h3>What other people say...</h3></header> @foreach($posts as $post) <article class="post" data-postid="{{ $post->id }}"> <p>{{ $post->body }}</p> <div class="info"> Posted by {{ $post->user->first_name }} on {{ $post->created_at }} </div> <div class="interaction"> <a href="#" class="like">{{ Auth::user()->likes()->where('post_id', $post->id)->first() ? Auth::user()->likes()->where('post_id', $post->id)->first()->like == 1 ? 'You like this post' : 'Like' : 'Like' }}</a> | <a href="#" class="like">{{ Auth::user()->likes()->where('post_id', $post->id)->first() ? Auth::user()->likes()->where('post_id', $post->id)->first()->like == 0 ? 'You don\'t like this post' : 'Dislike' : 'Dislike' }}</a> @if(Auth::user() == $post->user) | <a href="#" class="edit">Edit</a> | <a href="{{ route('post.delete', ['post_id' => $post->id]) }}">Delete</a> @endif </div> </article> @endforeach </div> </section> <div class="modal fade" tabindex="-1" role="dialog" id="edit-modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Edit Post</h4> </div> <div class="modal-body"> <form> <div class="form-group"> <label for="post-body">Edit the Post</label> <textarea class="form-control" name="post-body" id="post-body" rows="5"></textarea> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" id="modal-save">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <script> var token = '{{ Session::token() }}'; var urlEdit = '{{ route('edit') }}'; var urlLike = '{{ route('like') }}'; </script> @endsection
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/account.blade.php
resources/views/account.blade.php
@extends('layouts.master') @section('title') Account @endsection @section('content') <section class="row new-post"> <div class="col-md-6 col-md-offset-3"> <header><h3>Your Account</h3></header> <form action="{{ route('account.save') }}" method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="first_name">First Name</label> <input type="text" name="first_name" class="form-control" value="{{ $user->first_name }}" id="first_name"> </div> <div class="form-group"> <label for="image">Image (only .jpg)</label> <input type="file" name="image" class="form-control" id="image"> </div> <button type="submit" class="btn btn-primary">Save Account</button> <input type="hidden" value="{{ Session::token() }}" name="_token"> </form> </div> </section> @if (Storage::disk('local')->has($user->first_name . '-' . $user->id . '.jpg')) <section class="row new-post"> <div class="col-md-6 col-md-offset-3"> <img src="{{ route('account.image', ['filename' => $user->first_name . '-' . $user->id . '.jpg']) }}" alt="" class="img-responsive"> </div> </section> @endif @endsection
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/errors/503.blade.php
resources/views/errors/503.blade.php
<!DOCTYPE html> <html> <head> <title>Be right back.</title> <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"> <style> html, body { height: 100%; } body { margin: 0; padding: 0; width: 100%; color: #B0BEC5; display: table; font-weight: 100; font-family: 'Lato'; } .container { text-align: center; display: table-cell; vertical-align: middle; } .content { text-align: center; display: inline-block; } .title { font-size: 72px; margin-bottom: 40px; } </style> </head> <body> <div class="container"> <div class="content"> <div class="title">Be right back.</div> </div> </div> </body> </html>
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/includes/message-block.blade.php
resources/views/includes/message-block.blade.php
@if(count($errors) > 0) <div class="row"> <div class="col-md-4 col-md-offset-4 error"> <ul> @foreach($errors->all() as $error) <li>{{$error}}</li> @endforeach </ul> </div> </div> @endif @if(Session::has('message')) <div class="row"> <div class="col-md-4 col-md-offset-4 success"> {{Session::get('message')}} </div> </div> @endif
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/includes/header.blade.php
resources/views/includes/header.blade.php
<header> <nav class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="{{ route('dashboard') }}">Brand</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li><a href="{{ route('account') }}">Account</a></li> <li><a href="{{ route('logout') }}">Logout</a></li> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> </header>
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
mschwarzmueller/laravel-basics-youtube
https://github.com/mschwarzmueller/laravel-basics-youtube/blob/1295312ab4e0b26f839fb161e9aedf9044559422/resources/views/layouts/master.blade.php
resources/views/layouts/master.blade.php
<!DOCTYPE html> <html> <head> <title>@yield('title')</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <link rel="stylesheet" href="{{ URL::to('src/css/main.css') }}"> </head> <body> @include('includes.header') <div class="container"> @yield('content') </div> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> <script src="{{ URL::to('src/js/app.js') }}"></script> </body> </html>
php
MIT
1295312ab4e0b26f839fb161e9aedf9044559422
2026-01-05T05:04:32.355687Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/PublishedFlagScope.php
src/Scopes/Classic/PublishedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class PublishedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Publish', 'UndoPublish', 'WithNotPublished', 'WithoutNotPublished', 'OnlyNotPublished', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyPublishedFlagScope') && $model->shouldApplyPublishedFlagScope()) { $builder->where('is_published', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `publish` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addPublish(Builder $builder): void { $builder->macro('publish', function (Builder $builder) { $builder->withNotPublished(); return $builder->update(['is_published' => 1]); }); } /** * Add the `undoPublish` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoPublish(Builder $builder): void { $builder->macro('undoPublish', function (Builder $builder) { return $builder->update(['is_published' => 0]); }); } /** * Add the `withNotPublished` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotPublished(Builder $builder): void { $builder->macro('withNotPublished', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotPublished` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotPublished(Builder $builder): void { $builder->macro('withoutNotPublished', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_published', 1); }); } /** * Add the `onlyNotPublished` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotPublished(Builder $builder): void { $builder->macro('onlyNotPublished', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_published', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/AcceptedAtScope.php
src/Scopes/Classic/AcceptedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class AcceptedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Accept', 'UndoAccept', 'WithNotAccepted', 'WithoutNotAccepted', 'OnlyNotAccepted', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyAcceptedAtScope') && $model->shouldApplyAcceptedAtScope()) { $builder->whereNotNull('accepted_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `accept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addAccept(Builder $builder): void { $builder->macro('accept', function (Builder $builder) { $builder->withNotAccepted(); return $builder->update(['accepted_at' => Date::now()]); }); } /** * Add the `undoAccept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoAccept(Builder $builder): void { $builder->macro('undoAccept', function (Builder $builder) { return $builder->update(['accepted_at' => null]); }); } /** * Add the `withNotAccepted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotAccepted(Builder $builder): void { $builder->macro('withNotAccepted', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotAccepted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotAccepted(Builder $builder): void { $builder->macro('withoutNotAccepted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('accepted_at'); }); } /** * Add the `onlyNotAccepted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotAccepted(Builder $builder): void { $builder->macro('onlyNotAccepted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('accepted_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/KeptFlagScope.php
src/Scopes/Classic/KeptFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class KeptFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Keep', 'UndoKeep', 'WithNotKept', 'WithoutNotKept', 'OnlyNotKept', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyKeptFlagScope') && $model->shouldApplyKeptFlagScope()) { $builder->where('is_kept', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `keep` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addKeep(Builder $builder): void { $builder->macro('keep', function (Builder $builder) { $builder->withNotKept(); return $builder->update(['is_kept' => 1]); }); } /** * Add the `undoKeep` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoKeep(Builder $builder): void { $builder->macro('undoKeep', function (Builder $builder) { return $builder->update(['is_kept' => 0]); }); } /** * Add the `withNotKept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotKept(Builder $builder): void { $builder->macro('withNotKept', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotKept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotKept(Builder $builder): void { $builder->macro('withoutNotKept', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_kept', 1); }); } /** * Add the `onlyNotKept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotKept(Builder $builder): void { $builder->macro('onlyNotKept', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_kept', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/ApprovedFlagScope.php
src/Scopes/Classic/ApprovedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class ApprovedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Approve', 'UndoApprove', 'WithNotApproved', 'WithoutNotApproved', 'OnlyNotApproved', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyApprovedFlagScope') && $model->shouldApplyApprovedFlagScope()) { $builder->where('is_approved', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `approve` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addApprove(Builder $builder): void { $builder->macro('approve', function (Builder $builder) { $builder->withNotApproved(); return $builder->update(['is_approved' => 1]); }); } /** * Add the `undoApprove` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoApprove(Builder $builder): void { $builder->macro('undoApprove', function (Builder $builder) { return $builder->update(['is_approved' => 0]); }); } /** * Add the `withNotApproved` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotApproved(Builder $builder): void { $builder->macro('withNotApproved', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotApproved` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotApproved(Builder $builder): void { $builder->macro('withoutNotApproved', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_approved', 1); }); } /** * Add the `onlyNotApproved` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotApproved(Builder $builder): void { $builder->macro('onlyNotApproved', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_approved', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/InvitedFlagScope.php
src/Scopes/Classic/InvitedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class InvitedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Invite', 'UndoInvite', 'WithNotInvited', 'WithoutNotInvited', 'OnlyNotInvited', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyInvitedFlagScope') && $model->shouldApplyInvitedFlagScope()) { $builder->where('is_invited', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `invite` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addInvite(Builder $builder): void { $builder->macro('invite', function (Builder $builder) { $builder->withNotInvited(); return $builder->update(['is_invited' => 1]); }); } /** * Add the `undoInvite` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoInvite(Builder $builder): void { $builder->macro('undoInvite', function (Builder $builder) { return $builder->update(['is_invited' => 0]); }); } /** * Add the `withNotInvited` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotInvited(Builder $builder): void { $builder->macro('withNotInvited', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotInvited` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotInvited(Builder $builder): void { $builder->macro('withoutNotInvited', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_invited', 1); }); } /** * Add the `onlyNotInvited` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotInvited(Builder $builder): void { $builder->macro('onlyNotInvited', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_invited', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/InvitedAtScope.php
src/Scopes/Classic/InvitedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class InvitedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Invite', 'UndoInvite', 'WithNotInvited', 'WithoutNotInvited', 'OnlyNotInvited', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyInvitedAtScope') && $model->shouldApplyInvitedAtScope()) { $builder->whereNotNull('invited_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `invite` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addInvite(Builder $builder): void { $builder->macro('invite', function (Builder $builder) { $builder->withNotInvited(); return $builder->update(['invited_at' => Date::now()]); }); } /** * Add the `undoInvite` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoInvite(Builder $builder): void { $builder->macro('undoInvite', function (Builder $builder) { return $builder->update(['invited_at' => null]); }); } /** * Add the `withNotInvited` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotInvited(Builder $builder): void { $builder->macro('withNotInvited', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotInvited` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotInvited(Builder $builder): void { $builder->macro('withoutNotInvited', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('invited_at'); }); } /** * Add the `onlyNotInvited` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotInvited(Builder $builder): void { $builder->macro('onlyNotInvited', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('invited_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/AcceptedFlagScope.php
src/Scopes/Classic/AcceptedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class AcceptedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Accept', 'UndoAccept', 'WithNotAccepted', 'WithoutNotAccepted', 'OnlyNotAccepted', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyAcceptedFlagScope') && $model->shouldApplyAcceptedFlagScope()) { $builder->where('is_accepted', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `accept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addAccept(Builder $builder): void { $builder->macro('accept', function (Builder $builder) { $builder->withNotAccepted(); return $builder->update(['is_accepted' => 1]); }); } /** * Add the `undoAccept` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoAccept(Builder $builder): void { $builder->macro('undoAccept', function (Builder $builder) { return $builder->update(['is_accepted' => 0]); }); } /** * Add the `withNotAccepted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotAccepted(Builder $builder): void { $builder->macro('withNotAccepted', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotAccepted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotAccepted(Builder $builder): void { $builder->macro('withoutNotAccepted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_accepted', 1); }); } /** * Add the `onlyNotAccepted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotAccepted(Builder $builder): void { $builder->macro('onlyNotAccepted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_accepted', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/ActiveFlagScope.php
src/Scopes/Classic/ActiveFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class ActiveFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Activate', 'UndoActivate', 'WithNotActivated', 'WithoutNotActivated', 'OnlyNotActivated', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyActiveFlagScope') && $model->shouldApplyActiveFlagScope()) { $builder->where('is_active', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `activate` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addActivate(Builder $builder): void { $builder->macro('activate', function (Builder $builder) { $builder->withNotActivated(); return $builder->update(['is_active' => 1]); }); } /** * Add the `undoActivate` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoActivate(Builder $builder): void { $builder->macro('undoActivate', function (Builder $builder) { return $builder->update(['is_active' => 0]); }); } /** * Add the `withNotActivated` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotActivated(Builder $builder): void { $builder->macro('withNotActivated', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotActivated` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotActivated(Builder $builder): void { $builder->macro('withoutNotActivated', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_active', 1); }); } /** * Add the `onlyNotActivated` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotActivated(Builder $builder): void { $builder->macro('onlyNotActivated', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_active', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/VerifiedFlagScope.php
src/Scopes/Classic/VerifiedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class VerifiedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Verify', 'UndoVerify', 'WithNotVerified', 'WithoutNotVerified', 'OnlyNotVerified', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyVerifiedFlagScope') && $model->shouldApplyVerifiedFlagScope()) { $builder->where('is_verified', 1); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `verify` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addVerify(Builder $builder): void { $builder->macro('verify', function (Builder $builder) { $builder->withNotVerified(); return $builder->update(['is_verified' => 1]); }); } /** * Add the `undoVerify` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoVerify(Builder $builder): void { $builder->macro('undoVerify', function (Builder $builder) { return $builder->update(['is_verified' => 0]); }); } /** * Add the `withNotVerified` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotVerified(Builder $builder): void { $builder->macro('withNotVerified', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotVerified` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotVerified(Builder $builder): void { $builder->macro('withoutNotVerified', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_verified', 1); }); } /** * Add the `onlyNotVerified` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotVerified(Builder $builder): void { $builder->macro('onlyNotVerified', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_verified', 0); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/PublishedAtScope.php
src/Scopes/Classic/PublishedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class PublishedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Publish', 'UndoPublish', 'WithNotPublished', 'WithoutNotPublished', 'OnlyNotPublished', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyPublishedAtScope') && $model->shouldApplyPublishedAtScope()) { $builder->whereNotNull('published_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `publish` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addPublish(Builder $builder): void { $builder->macro('publish', function (Builder $builder) { $builder->withNotPublished(); return $builder->update(['published_at' => Date::now()]); }); } /** * Add the `undoPublish` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoPublish(Builder $builder): void { $builder->macro('undoPublish', function (Builder $builder) { return $builder->update(['published_at' => null]); }); } /** * Add the `withNotPublished` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotPublished(Builder $builder): void { $builder->macro('withNotPublished', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotPublished` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotPublished(Builder $builder): void { $builder->macro('withoutNotPublished', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('published_at'); }); } /** * Add the `onlyNotPublished` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotPublished(Builder $builder): void { $builder->macro('onlyNotPublished', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('published_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/VerifiedAtScope.php
src/Scopes/Classic/VerifiedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class VerifiedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Verify', 'UndoVerify', 'WithNotVerified', 'WithoutNotVerified', 'OnlyNotVerified', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyVerifiedAtScope') && $model->shouldApplyVerifiedAtScope()) { $builder->whereNotNull('verified_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `verify` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addVerify(Builder $builder): void { $builder->macro('verify', function (Builder $builder) { $builder->withNotVerified(); return $builder->update(['verified_at' => Date::now()]); }); } /** * Add the `undoVerify` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoVerify(Builder $builder): void { $builder->macro('undoVerify', function (Builder $builder) { return $builder->update(['verified_at' => null]); }); } /** * Add the `withNotVerified` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotVerified(Builder $builder): void { $builder->macro('withNotVerified', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotVerified` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotVerified(Builder $builder): void { $builder->macro('withoutNotVerified', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('verified_at'); }); } /** * Add the `onlyNotVerified` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotVerified(Builder $builder): void { $builder->macro('onlyNotVerified', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('verified_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Classic/ApprovedAtScope.php
src/Scopes/Classic/ApprovedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Classic; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class ApprovedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'Approve', 'UndoApprove', 'WithNotApproved', 'WithoutNotApproved', 'OnlyNotApproved', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyApprovedAtScope') && $model->shouldApplyApprovedAtScope()) { $builder->whereNotNull('approved_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `approve` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addApprove(Builder $builder): void { $builder->macro('approve', function (Builder $builder) { $builder->withNotApproved(); return $builder->update(['approved_at' => Date::now()]); }); } /** * Add the `undoApprove` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoApprove(Builder $builder): void { $builder->macro('undoApprove', function (Builder $builder) { return $builder->update(['approved_at' => null]); }); } /** * Add the `withNotApproved` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithNotApproved(Builder $builder): void { $builder->macro('withNotApproved', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutNotApproved` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutNotApproved(Builder $builder): void { $builder->macro('withoutNotApproved', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('approved_at'); }); } /** * Add the `onlyNotApproved` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyNotApproved(Builder $builder): void { $builder->macro('onlyNotApproved', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('approved_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/EndedFlagScope.php
src/Scopes/Inverse/EndedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class EndedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoEnd', 'End', 'WithEnded', 'WithoutEnded', 'OnlyEnded', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyEndedFlagScope') && $model->shouldApplyEndedFlagScope()) { $builder->where('is_ended', 0); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoEnd` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoEnd(Builder $builder): void { $builder->macro('undoEnd', function (Builder $builder) { $builder->withEnded(); return $builder->update(['is_ended' => 0]); }); } /** * Add the `end` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addEnd(Builder $builder): void { $builder->macro('end', function (Builder $builder) { return $builder->update(['is_ended' => 1]); }); } /** * Add the `withEnded` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithEnded(Builder $builder): void { $builder->macro('withEnded', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutEnded` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutEnded(Builder $builder): void { $builder->macro('withoutEnded', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_ended', 0); }); } /** * Add the `onlyEnded` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyEnded(Builder $builder): void { $builder->macro('onlyEnded', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_ended', 1); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/ArchivedFlagScope.php
src/Scopes/Inverse/ArchivedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class ArchivedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoArchive', 'Archive', 'WithArchived', 'WithoutArchived', 'OnlyArchived', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyArchivedFlagScope') && $model->shouldApplyArchivedFlagScope()) { $builder->where('is_archived', 0); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoArchive` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoArchive(Builder $builder): void { $builder->macro('undoArchive', function (Builder $builder) { $builder->withArchived(); return $builder->update(['is_archived' => 0]); }); } /** * Add the `archive` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addArchive(Builder $builder): void { $builder->macro('archive', function (Builder $builder) { return $builder->update(['is_archived' => 1]); }); } /** * Add the `withArchived` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithArchived(Builder $builder): void { $builder->macro('withArchived', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutArchived` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutArchived(Builder $builder): void { $builder->macro('withoutArchived', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_archived', 0); }); } /** * Add the `onlyArchived` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyArchived(Builder $builder): void { $builder->macro('onlyArchived', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_archived', 1); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/DraftedAtScope.php
src/Scopes/Inverse/DraftedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class DraftedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoDraft', 'Draft', 'WithDrafted', 'WithoutDrafted', 'OnlyDrafted', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyDraftedAtScope') && $model->shouldApplyDraftedAtScope()) { $builder->whereNull('drafted_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoDraft` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoDraft(Builder $builder): void { $builder->macro('undoDraft', function (Builder $builder) { $builder->withDrafted(); return $builder->update(['drafted_at' => null]); }); } /** * Add the `draft` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addDraft(Builder $builder): void { $builder->macro('draft', function (Builder $builder) { return $builder->update(['drafted_at' => Date::now()]); }); } /** * Add the `withDrafted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithDrafted(Builder $builder): void { $builder->macro('withDrafted', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutDrafted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutDrafted(Builder $builder): void { $builder->macro('withoutDrafted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('drafted_at'); }); } /** * Add the `onlyDrafted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyDrafted(Builder $builder): void { $builder->macro('onlyDrafted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('drafted_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/ExpiredFlagScope.php
src/Scopes/Inverse/ExpiredFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class ExpiredFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoExpire', 'Expire', 'WithExpired', 'WithoutExpired', 'OnlyExpired', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyExpiredFlagScope') && $model->shouldApplyExpiredFlagScope()) { $builder->where('is_expired', 0); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoExpire` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoExpire(Builder $builder): void { $builder->macro('undoExpire', function (Builder $builder) { $builder->withExpired(); return $builder->update(['is_expired' => 0]); }); } /** * Add the `expire` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addExpire(Builder $builder): void { $builder->macro('expire', function (Builder $builder) { return $builder->update(['is_expired' => 1]); }); } /** * Add the `withExpired` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithExpired(Builder $builder): void { $builder->macro('withExpired', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutExpired` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutExpired(Builder $builder): void { $builder->macro('withoutExpired', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_expired', 0); }); } /** * Add the `onlyExpired` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyExpired(Builder $builder): void { $builder->macro('onlyExpired', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_expired', 1); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/ClosedFlagScope.php
src/Scopes/Inverse/ClosedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class ClosedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoClose', 'Close', 'WithClosed', 'WithoutClosed', 'OnlyClosed', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyClosedFlagScope') && $model->shouldApplyClosedFlagScope()) { $builder->where('is_closed', 0); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoClose` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoClose(Builder $builder): void { $builder->macro('undoClose', function (Builder $builder) { $builder->withClosed(); return $builder->update(['is_closed' => 0]); }); } /** * Add the `close` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addClose(Builder $builder): void { $builder->macro('close', function (Builder $builder) { return $builder->update(['is_closed' => 1]); }); } /** * Add the `withClosed` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithClosed(Builder $builder): void { $builder->macro('withClosed', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutClosed` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutClosed(Builder $builder): void { $builder->macro('withoutClosed', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_closed', 0); }); } /** * Add the `onlyClosed` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyClosed(Builder $builder): void { $builder->macro('onlyClosed', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_closed', 1); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/DraftedFlagScope.php
src/Scopes/Inverse/DraftedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; final class DraftedFlagScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoDraft', 'Draft', 'WithDrafted', 'WithoutDrafted', 'OnlyDrafted', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyDraftedFlagScope') && $model->shouldApplyDraftedFlagScope()) { $builder->where('is_drafted', 0); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoDraft` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoDraft(Builder $builder): void { $builder->macro('undoDraft', function (Builder $builder) { $builder->withDrafted(); return $builder->update(['is_drafted' => 0]); }); } /** * Add the `draft` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addDraft(Builder $builder): void { $builder->macro('draft', function (Builder $builder) { return $builder->update(['is_drafted' => 1]); }); } /** * Add the `withDrafted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithDrafted(Builder $builder): void { $builder->macro('withDrafted', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutDrafted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutDrafted(Builder $builder): void { $builder->macro('withoutDrafted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_drafted', 0); }); } /** * Add the `onlyDrafted` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyDrafted(Builder $builder): void { $builder->macro('onlyDrafted', function (Builder $builder) { return $builder->withoutGlobalScope($this)->where('is_drafted', 1); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/ArchivedAtScope.php
src/Scopes/Inverse/ArchivedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class ArchivedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoArchive', 'Archive', 'WithArchived', 'WithoutArchived', 'OnlyArchived', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyArchivedAtScope') && $model->shouldApplyArchivedAtScope()) { $builder->whereNull('archived_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoArchive` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoArchive(Builder $builder): void { $builder->macro('undoArchive', function (Builder $builder) { $builder->withArchived(); return $builder->update(['archived_at' => null]); }); } /** * Add the `archive` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addArchive(Builder $builder): void { $builder->macro('archive', function (Builder $builder) { return $builder->update(['archived_at' => Date::now()]); }); } /** * Add the `withArchived` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithArchived(Builder $builder): void { $builder->macro('withArchived', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutArchived` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutArchived(Builder $builder): void { $builder->macro('withoutArchived', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('archived_at'); }); } /** * Add the `onlyArchived` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyArchived(Builder $builder): void { $builder->macro('onlyArchived', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('archived_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/ClosedAtScope.php
src/Scopes/Inverse/ClosedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class ClosedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoClose', 'Close', 'WithClosed', 'WithoutClosed', 'OnlyClosed', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyClosedAtScope') && $model->shouldApplyClosedAtScope()) { $builder->whereNull('closed_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoClose` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoClose(Builder $builder): void { $builder->macro('undoClose', function (Builder $builder) { $builder->withClosed(); return $builder->update(['closed_at' => null]); }); } /** * Add the `close` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addClose(Builder $builder): void { $builder->macro('close', function (Builder $builder) { return $builder->update(['closed_at' => Date::now()]); }); } /** * Add the `withClosed` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithClosed(Builder $builder): void { $builder->macro('withClosed', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutClosed` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutClosed(Builder $builder): void { $builder->macro('withoutClosed', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('closed_at'); }); } /** * Add the `onlyClosed` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyClosed(Builder $builder): void { $builder->macro('onlyClosed', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('closed_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/ExpiredAtScope.php
src/Scopes/Inverse/ExpiredAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class ExpiredAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoExpire', 'Expire', 'WithExpired', 'WithoutExpired', 'OnlyExpired', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyExpiredAtScope') && $model->shouldApplyExpiredAtScope()) { $builder->whereNull('expired_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoExpire` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoExpire(Builder $builder): void { $builder->macro('undoExpire', function (Builder $builder) { $builder->withExpired(); return $builder->update(['expired_at' => null]); }); } /** * Add the `expire` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addExpire(Builder $builder): void { $builder->macro('expire', function (Builder $builder) { return $builder->update(['expired_at' => Date::now()]); }); } /** * Add the `withExpired` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithExpired(Builder $builder): void { $builder->macro('withExpired', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutExpired` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutExpired(Builder $builder): void { $builder->macro('withoutExpired', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('expired_at'); }); } /** * Add the `onlyExpired` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyExpired(Builder $builder): void { $builder->macro('onlyExpired', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('expired_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Scopes/Inverse/EndedAtScope.php
src/Scopes/Inverse/EndedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Scopes\Inverse; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Facades\Date; final class EndedAtScope implements Scope { /** * All of the extensions to be added to the builder. * * @var array */ protected $extensions = [ 'UndoEnd', 'End', 'WithEnded', 'WithoutEnded', 'OnlyEnded', ]; /** * Apply the scope to a given Eloquent query builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param \Illuminate\Database\Eloquent\Model $model * @return void */ public function apply(Builder $builder, Model $model): void { if (method_exists($model, 'shouldApplyEndedAtScope') && $model->shouldApplyEndedAtScope()) { $builder->whereNull('ended_at'); } } /** * Extend the query builder with the needed functions. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder): void { foreach ($this->extensions as $extension) { $this->{"add{$extension}"}($builder); } } /** * Add the `undoEnd` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addUndoEnd(Builder $builder): void { $builder->macro('undoEnd', function (Builder $builder) { $builder->withEnded(); return $builder->update(['ended_at' => null]); }); } /** * Add the `end` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addEnd(Builder $builder): void { $builder->macro('end', function (Builder $builder) { return $builder->update(['ended_at' => Date::now()]); }); } /** * Add the `withEnded` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithEnded(Builder $builder): void { $builder->macro('withEnded', function (Builder $builder) { return $builder->withoutGlobalScope($this); }); } /** * Add the `withoutEnded` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutEnded(Builder $builder): void { $builder->macro('withoutEnded', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNull('ended_at'); }); } /** * Add the `onlyEnded` extension to the builder. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyEnded(Builder $builder): void { $builder->macro('onlyEnded', function (Builder $builder) { return $builder->withoutGlobalScope($this)->whereNotNull('ended_at'); }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasKeptFlagBehavior.php
src/Traits/Classic/HasKeptFlagBehavior.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasKeptFlagBehavior { /** * Set `is_kept = true` on entity update. * * @var bool */ protected $setKeptOnUpdate = true; /** * Boot the bootHasKeptFlagBehavior trait for a model. * * @return void */ public static function bootHasKeptFlagBehavior(): void { static::creating(function ($entity) { if (!$entity->is_kept) { $entity->is_kept = false; } }); static::updating(function ($entity) { if (!$entity->is_kept && $entity->setKeptOnUpdate) { $entity->is_kept = true; } }); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasVerifiedFlag.php
src/Traits/Classic/HasVerifiedFlag.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasVerifiedFlag { use HasVerifiedFlagHelpers; use HasVerifiedFlagScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasAcceptedAtHelpers.php
src/Traits/Classic/HasAcceptedAtHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Illuminate\Support\Facades\Date; trait HasAcceptedAtHelpers { public function initializeHasAcceptedAtHelpers(): void { $this->casts['accepted_at'] = 'datetime'; } public function isAccepted(): bool { return !is_null($this->getAttributeValue('accepted_at')); } public function isNotAccepted(): bool { return !$this->isAccepted(); } public function accept(): void { $this->setAttribute('accepted_at', Date::now()); $this->save(); $this->fireModelEvent('accepted', false); } public function undoAccept(): void { $this->setAttribute('accepted_at', null); $this->save(); $this->fireModelEvent('acceptedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasApprovedAtHelpers.php
src/Traits/Classic/HasApprovedAtHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Illuminate\Support\Facades\Date; trait HasApprovedAtHelpers { public function initializeHasApprovedAtHelpers(): void { $this->casts['approved_at'] = 'datetime'; } public function isApproved(): bool { return !is_null($this->getAttributeValue('approved_at')); } public function isNotApproved(): bool { return !$this->isApproved(); } public function approve(): void { $this->setAttribute('approved_at', Date::now()); $this->save(); $this->fireModelEvent('approved', false); } public function undoApprove(): void { $this->setAttribute('approved_at', null); $this->save(); $this->fireModelEvent('approvedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasInvitedFlagHelpers.php
src/Traits/Classic/HasInvitedFlagHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasInvitedFlagHelpers { public function initializeHasInvitedFlagHelpers(): void { $this->casts['is_invited'] = 'boolean'; } public function isInvited(): bool { return $this->getAttributeValue('is_invited'); } public function isNotInvited(): bool { return !$this->isInvited(); } public function invite(): void { $this->setAttribute('is_invited', true); $this->save(); $this->fireModelEvent('invited', false); } public function undoInvite(): void { $this->setAttribute('is_invited', false); $this->save(); $this->fireModelEvent('invitedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasInvitedFlag.php
src/Traits/Classic/HasInvitedFlag.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasInvitedFlag { use HasInvitedFlagHelpers; use HasInvitedFlagScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasPublishedAt.php
src/Traits/Classic/HasPublishedAt.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasPublishedAt { use HasPublishedAtHelpers; use HasPublishedAtScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasActiveFlagHelpers.php
src/Traits/Classic/HasActiveFlagHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasActiveFlagHelpers { public function initializeHasActiveFlagHelpers(): void { $this->casts['is_active'] = 'boolean'; } public function isActivated(): bool { return $this->getAttributeValue('is_active'); } public function isNotActivated(): bool { return !$this->isActivated(); } public function activate(): void { $this->setAttribute('is_active', true); $this->save(); $this->fireModelEvent('activated', false); } public function undoActivate(): void { $this->setAttribute('is_active', false); $this->save(); $this->fireModelEvent('activatedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasApprovedFlag.php
src/Traits/Classic/HasApprovedFlag.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasApprovedFlag { use HasApprovedFlagHelpers; use HasApprovedFlagScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasVerifiedAtHelpers.php
src/Traits/Classic/HasVerifiedAtHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Illuminate\Support\Facades\Date; trait HasVerifiedAtHelpers { public function initializeHasVerifiedAtHelpers(): void { $this->casts['verified_at'] = 'datetime'; } public function isVerified(): bool { return !is_null($this->getAttributeValue('verified_at')); } public function isNotVerified(): bool { return !$this->isVerified(); } public function verify(): void { $this->setAttribute('verified_at', Date::now()); $this->save(); $this->fireModelEvent('verified', false); } public function undoVerify(): void { $this->setAttribute('verified_at', null); $this->save(); $this->fireModelEvent('verifiedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasActiveFlagScope.php
src/Traits/Classic/HasActiveFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Cog\Flag\Scopes\Classic\ActiveFlagScope; trait HasActiveFlagScope { /** * Boot the HasActiveFlagScope trait for a model. * * @return void */ public static function bootHasActiveFlagScope(): void { static::addGlobalScope(new ActiveFlagScope()); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasAcceptedAt.php
src/Traits/Classic/HasAcceptedAt.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasAcceptedAt { use HasAcceptedAtHelpers; use HasAcceptedAtScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasApprovedFlagHelpers.php
src/Traits/Classic/HasApprovedFlagHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasApprovedFlagHelpers { public function initializeHasApprovedFlagHelpers(): void { $this->casts['is_approved'] = 'boolean'; } public function isApproved(): bool { return $this->getAttributeValue('is_approved'); } public function isNotApproved(): bool { return !$this->isApproved(); } public function approve(): void { $this->setAttribute('is_approved', true); $this->save(); $this->fireModelEvent('approved', false); } public function undoApprove(): void { $this->setAttribute('is_approved', false); $this->save(); $this->fireModelEvent('approvedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasPublishedFlagScope.php
src/Traits/Classic/HasPublishedFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Cog\Flag\Scopes\Classic\PublishedFlagScope; trait HasPublishedFlagScope { /** * Boot the HasPublishedFlagScope trait for a model. * * @return void */ public static function bootHasPublishedFlagScope(): void { static::addGlobalScope(new PublishedFlagScope()); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasPublishedFlag.php
src/Traits/Classic/HasPublishedFlag.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasPublishedFlag { use HasPublishedFlagHelpers; use HasPublishedFlagScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasAcceptedFlag.php
src/Traits/Classic/HasAcceptedFlag.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasAcceptedFlag { use HasAcceptedFlagHelpers; use HasAcceptedFlagScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasPublishedAtHelpers.php
src/Traits/Classic/HasPublishedAtHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Illuminate\Support\Facades\Date; trait HasPublishedAtHelpers { public function initializeHasPublishedAtHelpers(): void { $this->casts['published_at'] = 'datetime'; } public function isPublished(): bool { return !is_null($this->getAttributeValue('published_at')); } public function isNotPublished(): bool { return !$this->isPublished(); } public function publish(): void { $this->setAttribute('published_at', Date::now()); $this->save(); $this->fireModelEvent('published', false); } public function undoPublish(): void { $this->setAttribute('published_at', null); $this->save(); $this->fireModelEvent('publishedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasKeptFlagHelpers.php
src/Traits/Classic/HasKeptFlagHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Cog\Flag\Scopes\Classic\KeptFlagScope; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\Date; trait HasKeptFlagHelpers { public function initializeHasKeptFlagHelpers(): void { $this->casts['is_kept'] = 'boolean'; } public function isKept(): bool { return $this->getAttributeValue('is_kept'); } public function isNotKept(): bool { return !$this->isKept(); } public function keep(): void { $this->setAttribute('is_kept', true); $this->save(); $this->fireModelEvent('kept', false); } public function undoKeep(): void { $this->setAttribute('is_kept', false); if (property_exists($this, 'setKeptOnUpdate')) { $this->setKeptOnUpdate = false; } $this->save(); $this->fireModelEvent('keptUndone', false); } /** * Get unkept models that are older than the given number of hours. * * @param \Illuminate\Database\Eloquent\Builder $builder * @param int $hours * @return \Illuminate\Database\Eloquent\Builder */ public function scopeOnlyUnkeptOlderThanHours(Builder $builder, $hours) { return $builder ->withoutGlobalScope(KeptFlagScope::class) ->where('is_kept', 0) ->where(static::getCreatedAtColumn(), '<=', Date::now()->subHours($hours)->toDateTimeString()); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasVerifiedAt.php
src/Traits/Classic/HasVerifiedAt.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasVerifiedAt { use HasVerifiedAtHelpers; use HasVerifiedAtScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasKeptFlag.php
src/Traits/Classic/HasKeptFlag.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasKeptFlag { use HasKeptFlagBehavior; use HasKeptFlagHelpers; use HasKeptFlagScope; }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasVerifiedFlagHelpers.php
src/Traits/Classic/HasVerifiedFlagHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasVerifiedFlagHelpers { public function initializeHasVerifiedFlagHelpers(): void { $this->casts['is_verified'] = 'boolean'; } public function isVerified(): bool { return $this->getAttributeValue('is_verified'); } public function isNotVerified(): bool { return !$this->isVerified(); } public function verify(): void { $this->setAttribute('is_verified', true); $this->save(); $this->fireModelEvent('verified', false); } public function undoVerify(): void { $this->setAttribute('is_verified', false); $this->save(); $this->fireModelEvent('verifiedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasKeptFlagScope.php
src/Traits/Classic/HasKeptFlagScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Cog\Flag\Scopes\Classic\KeptFlagScope; trait HasKeptFlagScope { /** * Boot the HasKeptFlagScope trait for a model. * * @return void */ public static function bootHasKeptFlagScope(): void { static::addGlobalScope(new KeptFlagScope()); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasApprovedAtScope.php
src/Traits/Classic/HasApprovedAtScope.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; use Cog\Flag\Scopes\Classic\ApprovedAtScope; trait HasApprovedAtScope { /** * Boot the HasApprovedAtScope trait for a model. * * @return void */ public static function bootHasApprovedAtScope(): void { static::addGlobalScope(new ApprovedAtScope()); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false
cybercog/laravel-eloquent-flag
https://github.com/cybercog/laravel-eloquent-flag/blob/b78de1f45726511b73723b7f017a4a7f833c2546/src/Traits/Classic/HasAcceptedFlagHelpers.php
src/Traits/Classic/HasAcceptedFlagHelpers.php
<?php /* * This file is part of Laravel Eloquent Flag. * * (c) Anton Komarev <anton@komarev.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace Cog\Flag\Traits\Classic; trait HasAcceptedFlagHelpers { public function initializeHasAcceptedFlagHelpers(): void { $this->casts['is_accepted'] = 'boolean'; } public function isAccepted(): bool { return $this->getAttributeValue('is_accepted'); } public function isNotAccepted(): bool { return !$this->isAccepted(); } public function accept(): void { $this->setAttribute('is_accepted', true); $this->save(); $this->fireModelEvent('accepted', false); } public function undoAccept(): void { $this->setAttribute('is_accepted', false); $this->save(); $this->fireModelEvent('acceptedUndone', false); } }
php
MIT
b78de1f45726511b73723b7f017a4a7f833c2546
2026-01-05T05:04:43.856771Z
false