PHP code example of daltonmccleery / laravel-quick-start

1. Go to this page and download the library: Download daltonmccleery/laravel-quick-start library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

daltonmccleery / laravel-quick-start example snippets


/**
 * Register the application's Nova resources.
 *
 * @return void
*/
protected function resources()
{
    Nova::resourcesIn(app_path('Nova'));

    Nova::resources([
        \DaltonMcCleery\LaravelQuickStart\Nova\Page::class,
        \DaltonMcCleery\LaravelQuickStart\Nova\Redirect::class,
        \DaltonMcCleery\LaravelQuickStart\Nova\MainNavMenu::class,
        \DaltonMcCleery\LaravelQuickStart\Nova\BannerPromos::class,
        \DaltonMcCleery\LaravelQuickStart\Nova\MobileNavMenu::class,
        \DaltonMcCleery\LaravelQuickStart\Nova\FooterNavMenu::class,
        \DaltonMcCleery\LaravelQuickStart\Nova\ReusableBlocks::class
    ]);
}

protected $middleware = [
    // ...
    \DaltonMcCleery\LaravelQuickStart\Http\Middleware\RedirectRequests::class,
];

use DaltonMcCleery\LaravelQuickStart\Traits\HasModelRevisions;

class YourModel extends Model
{
    use HasModelRevisions;

use DaltonMcCleery\LaravelQuickStart\Traits\HasModelRevisions;

class YourModel extends Model
{

    /**
     * The "booted" method of the model.
     *
     * @return void
     */
    protected static function booted()
    {
        static::updating(function ($model) {
            if ($model->create_new_revision) {
                $model = self::create_static_revision($model);
            }
        });
    }

Boolean::make('Create New Revision', 'create_new_revision')
    ->trueValue(1)
    ->falseValue(0)
    ->hideFromDetail()->hideFromIndex()->hideWhenCreating()
    ->help('Create a new revision upon saving that can be reverted to at any time.')
    ->rules('nullable')

use DaltonMcCleery\LaravelQuickStart\Nova\Actions\RevertRevision;

public function actions(Request $request)
{
    return [
        new RevertRevision($request->resourceId, $this)
    ];
}

self::create_static_revision($model);

$this->create_revision($model);

$model->revert_last_revision();

$model->revert_to_revision(1);

Route::middleware('web')
    ->namespace($this->namespace)
    ->group(base_path('routes/web.php'));

// Add...
\DaltonMcCleery\LaravelQuickStart\LaravelQuickStartServiceProvider::registerRoutes();
bash
php artisan vendor:publish --provider="DaltonMcCleery\LaravelQuickStart\LaravelQuickStartServiceProvider" --force
bash
php artisan migrate