Ejemplo n.º 1
0
 public function __construct()
 {
     $this->middleware('departmentAccess:11');
     $statuses = new PaperStatus();
     if (systemAccess(100)) {
         $this->systemAdmin = true;
     }
     view()->share(['systemAdmin' => $this->systemAdmin, 'statuses' => $statuses->getStatuses()]);
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $this->department = $this->getDepartment();
     $this->middleware('paperArchive', ['except' => ['index', 'create', 'store']]);
     $this->middleware('lockPaper:' . $this->department->id, ['only' => ['create', 'store', 'edit', 'update', 'destroy', 'getInvoice', 'postInvoice']]);
     $this->paper = new PaperClass();
     $statuses = new PaperStatus();
     view()->share(['categories' => getNomenclatureSelect($this->getCategories(), true), 'statuses' => $statuses->getStatuses()]);
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->middleware('departmentAccess:1', ['only' => ['create', 'store', 'update', 'edit']]);
     $this->middleware('paperArchive', ['only' => ['update', 'edit', 'getEvaluate', 'postEvaluate']]);
     $this->middleware('adminDepartmentObject:Paper', ['only' => ['show', 'edit', 'update', 'getEvaluate', 'postEvaluate', 'delete']]);
     $departments = [];
     $this->systemAdmin = false;
     $this->paper = new PaperClass();
     $statuses = new PaperStatus();
     $select = [0 => trans('static.select')];
     $department = auth()->user()->department_id;
     if (systemAccess(100)) {
         $department = null;
         $this->systemAdmin = true;
         $departments = getNomenclatureSelect($this->getDepartmentsAdmin(), true);
     }
     view()->share(['categories' => getNomenclatureSelect($this->getCategories($department), true), 'departments' => $departments, 'statuses' => $select + $statuses->getStatuses(), 'systemAdmin' => $this->systemAdmin]);
 }
Ejemplo n.º 4
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = ['category_id' => 'required|exists:category,id', 'title' => 'required|min:3|max:255', 'description' => 'min:3|max:1000', 'paper' => 'required|max:32000|mimes:pdf,doc,docx', 'authors' => 'required|min:3|max:255'];
     if (isAdminPanel()) {
         $paper = new PaperStatus();
         if (systemAccess(100)) {
             $rules['department_id'] = 'required';
         }
         $rules['user_id'] = 'required|exists:users,id';
         $rules['payment_description'] = 'min:3|max:1000';
         $rules['payment_source'] = 'image|max:5000';
         $rules['status_id'] = 'required|between:1,' . count($paper->getStatuses());
     }
     if ($this->request->get('id')) {
         #update request1
         if (!$this->request->get('paper')) {
             $rules['paper'] = '';
         }
     }
     return $rules;
 }