Skip to content

Instantly share code, notes, and snippets.

@muhghazaliakbar
Created November 9, 2018 06:45
Show Gist options
  • Save muhghazaliakbar/9b3bafcfb036f00c76e3eff8b5a6f498 to your computer and use it in GitHub Desktop.
Save muhghazaliakbar/9b3bafcfb036f00c76e3eff8b5a6f498 to your computer and use it in GitHub Desktop.
Nova/Tag.php
<?php
namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
class Tag extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = \App\Tag::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'name';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'name'
];
/**
* 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('Namespace')
->sortable()
->hideWhenUpdating(),
Text::make('Name')
->sortable(),
Text::make('Slug')
->sortable(),
];
}
/**
* Get the cards available for the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function cards(Request $request)
{
return [];
}
/**
* Get the filters available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function filters(Request $request)
{
return [];
}
/**
* Get the lenses available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function lenses(Request $request)
{
return [];
}
/**
* Get the actions available for the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function actions(Request $request)
{
return [];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment