1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\Courses;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class CoursesController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = 'Courses';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new Courses());
- $grid->column('id', __('Id'));
- $grid->column('isActive', __('IsActive'));
- $grid->column('name', __('Name'));
- $grid->column('price', __('Price'));
- $grid->column('period', __('Period'));
- $grid->column('forma', __('Forma'));
- $grid->column('level', __('Level'));
- $grid->column('hours', __('Hours'));
- $grid->column('teacher_id', __('Teacher id'));
- $grid->column('organisation_id', __('Organisation id'));
- $grid->column('created_at', __('Created at'));
- $grid->column('updated_at', __('Updated at'));
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(Courses::findOrFail($id));
- $show->field('id', __('Id'));
- $show->field('isActive', __('IsActive'));
- $show->field('name', __('Name'));
- $show->field('price', __('Price'));
- $show->field('period', __('Period'));
- $show->field('forma', __('Forma'));
- $show->field('level', __('Level'));
- $show->field('hours', __('Hours'));
- $show->field('teacher_id', __('Teacher id'));
- $show->field('organisation_id', __('Organisation id'));
- $show->field('created_at', __('Created at'));
- $show->field('updated_at', __('Updated at'));
- return $show;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new Courses());
- $form->switch('isActive', __('IsActive'));
- $form->text('name', __('Name'));
- $form->number('price', __('Price'));
- $form->number('period', __('Period'));
- $form->text('forma', __('Forma'));
- $form->text('level', __('Level'));
- $form->number('hours', __('Hours'));
- $form->number('teacher_id', __('Teacher id'));
- $form->number('organisation_id', __('Organisation id'));
- return $form;
- }
- }
|