Files
backend-mm/app/Nova/Resources/CMS/Forms/ContactUS.php
2025-09-25 03:03:31 +05:00

133 lines
2.8 KiB
PHP

<?php
namespace App\Nova\Resources\CMS\Forms;
use App\Models\CMS\Forms\ContactUS as ContactUSModel;
use App\Models\System\Settings\OS;
use App\Nova\Resource;
use App\Nova\User;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\DateTime;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Textarea;
use Laravel\Nova\Http\Requests\NovaRequest;
class ContactUS extends Resource
{
/**
* The model the resource corresponds to.
*
* @var class-string<ContactUSModel>
*/
public static $model = ContactUSModel::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'title';
/**
* The relationships that should be eager loaded on index queries.
*
* @var array
*/
public static $with = ['user'];
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'title', 'phone',
];
/**
* Get the displayable label of the resource.
*/
public static function label(): string
{
return __('Messages');
}
/**
* Get the displayable singular label of the resource.
*/
public static function singularLabel(): string
{
return __('Message');
}
/**
* Get the fields displayed by the resource.
*/
public function fields(NovaRequest $request): array
{
return [
ID::make()->sortable(),
BelongsTo::make(__('User'), 'user', User::class),
Text::make(__('Phone'), 'phone')->rules('required'),
Text::make(__('Title'), 'title')->rules('required'),
Textarea::make(__('Content'), 'content')->rules('required')->alwaysShow(),
Select::make(__('Type'), 'type')
->options(OS::apps())
->displayUsingLabels()
->rules('required'),
DateTime::make(__('Created at'), 'created_at')
->turkmenDate()
->exceptOnForms(),
];
}
/**
* Get the cards available for the request.
*
* @return array
*/
public function cards(NovaRequest $request)
{
return [];
}
/**
* Get the filters available for the resource.
*
* @return array
*/
public function filters(NovaRequest $request)
{
return [];
}
/**
* Get the lenses available for the resource.
*
* @return array
*/
public function lenses(NovaRequest $request)
{
return [];
}
/**
* Get the actions available for the resource.
*
* @return array
*/
public function actions(NovaRequest $request)
{
return [];
}
}