Ignore:
Timestamp:
10/15/21 00:21:44 (3 years ago)
Author:
Berat Kjufliju <kufliju@…>
Branches:
develop, master
Children:
d795fa6
Parents:
24a616f
Message:

added UserFactory, edited html, added delete to departments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Controllers/Dashboard/DepartmentsController.php

    r24a616f r120759b  
    3434    }
    3535
     36    public function store(NewDepartmentRequest $request)
     37    {
     38        $department = new Department();
     39
     40        $department->name = $request->name;
     41        $department->code = $request->code;
     42
     43        if(!Storage::disk('local')->has('Departments/' . $request->code)){
     44            Storage::disk('local')->makeDirectory('Departments/' . $request->code);
     45        }
     46
     47        $department->user_id = auth()->id();
     48        $department->location = '/Departments/' . $request->code;
     49
     50        $department->save();
     51
     52        Alert::flash("New Department added successfully");
     53
     54        return redirect()->route("dashboard.departments.index");
     55    }
     56
    3657    public function edit(UpdateDepartmentRequest $request, $id)
    3758    {
     
    6283    }
    6384
    64     public function store(NewDepartmentRequest $request)
    65     {
    66         $department = new Department();
    67 
    68         $department->name = $request->name;
    69         $department->code = $request->code;
    70 
    71         if(!Storage::disk('local')->has('Departments/' . $request->code)){
    72             Storage::disk('local')->makeDirectory('Departments/' . $request->code);
    73         }
    74 
    75         $department->user_id = auth()->id();
    76         $department->location = '/Departments/' . $request->code;
    77 
    78         dd($department->location);
    79 
    80         $department->save();
    81 
    82         Alert::flash("New Department added successfully");
    83 
    84         return redirect()->route("dashboard.departments.index");
    85     }
    86 
    8785    public function destroy(Request $request, $id)
    8886    {
Note: See TracChangeset for help on using the changeset viewer.