-
-
Save czemu/dd00cd9f2a488df51c7979e79d9dd0ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Nova; | |
use Illuminate\Http\Request; | |
use Laravel\Nova\Fields\ID; | |
use Laravel\Nova\Fields\Text; | |
use Laravel\Nova\Fields\Textarea; | |
use Laravel\Nova\Fields\Markdown; | |
use Laravel\Nova\Fields\DateTime; | |
use Laravel\Nova\Fields\Boolean; | |
use Laravel\Nova\Fields\HasMany; | |
use Laravel\Nova\Http\Requests\NovaRequest; | |
class Recipe extends Resource | |
{ | |
/** | |
* The model the resource corresponds to. | |
* | |
* @var string | |
*/ | |
public static $model = 'App\Recipe'; | |
/** | |
* Get the fields displayed by the resource. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return array | |
*/ | |
public function fields(Request $request) | |
{ | |
return [ | |
ID::make()->sortable(), | |
Text::make('Name')->rules('required,max:255')->sortable(), | |
Textarea::make('Ingredients'), | |
Markdown::make('Preparation description'), | |
DateTime::make('Published at'), | |
Boolean::make('Is featured'), | |
HasMany::make('Categories'), | |
HasMany::make('Comments') | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment