68 lines
2.8 KiB
PHP
68 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Requests\LambdaRequest;
|
|
use App\Models\Faculty;
|
|
|
|
class FacultyController extends LocalController
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
$this->_service = 'mag';
|
|
$this->_module = 'magazine';
|
|
$this->_viewname = 'faculty';
|
|
$this->_title = 'Faculty';
|
|
$this->_base_url = '/faculty';
|
|
$this->_basemodel = new Faculty;
|
|
}
|
|
|
|
protected function get_list_buttons() {
|
|
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ] ];
|
|
}
|
|
|
|
protected function get_list_fields(){
|
|
return [
|
|
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
|
'type' => ['title' => 'Session Type', 'type' => 'text'],
|
|
'sort_order' => ['title' => 'Sort Order', 'type' => 'text'],
|
|
'image' => ['title' => 'Faculty Image', 'type' => 'image'],
|
|
'name' => ['title' => 'Faculty Name', 'type' => 'text'],
|
|
'status' => ['title' => 'Status', 'type' => 'select'],
|
|
];
|
|
}
|
|
|
|
protected function get_form_fields($type, $values){
|
|
$fields = [
|
|
'type' => ['title' => 'Session Type', 'type' => 'multiselect', 'values' => ['road' => 'Road', 'casper' => 'Casper', 'casper_clinic' => 'Casper Clinic', 'APFT' => 'APFT', 'spirometry_simplified' => 'Spirometry Simplified', 'casper_clinic_new' => 'Casper Clinic New', 'casper_plus' => 'Casper Plus', 'ecampus' => 'E-Campus', ], 'required' => true],
|
|
'name' => ['title' => 'Faculty Name', 'type' => 'text', 'required' => true],
|
|
'sort_order' => ['title' => 'Sort Order', 'type' => 'number', 'required' => true],
|
|
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
|
'description' => ['title' => 'Faculty Description', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
|
'image' => ['title' => 'Image', 'type' => 'image', 'required' => true ],
|
|
];
|
|
return $fields;
|
|
}
|
|
|
|
protected function _beforesave($type, $request) {
|
|
$data = $request->except('_token');
|
|
if( $request->file('image') ) {
|
|
$data['image'] = $this->_uploadMedia($request, 'image', 'faculty');
|
|
}
|
|
$data['type'] = implode(',',$data['type']);
|
|
//$data['library_ids'] = implode(',', $data['library_ids']);
|
|
//echo '<pre>'; print_r($data); exit;
|
|
return $data;
|
|
}
|
|
protected function _beforeform($type, $values) {
|
|
//$values->library_ids = explode(',', $values->library_ids);
|
|
//echo '<pre>'; print_r($values); exit;
|
|
if($type == 'edit') {
|
|
$values->type = explode(',',$values->type);
|
|
}
|
|
|
|
return $values;
|
|
}
|
|
}
|