Completed
Push — development ( 963d26...17d8c8 )
by Ashutosh
09:57
created

CategoryController   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 9
eloc 11
dl 0
loc 89
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 2 1
A store() 0 10 2
A edit() 0 2 1
A index() 0 3 1
A destroy() 0 2 1
A show() 0 2 1
A __construct() 0 4 1
A create() 0 2 1
1
<?php
2
3
namespace App\Http\Controllers\Product;
4
5
use Illuminate\Http\Request;
6
use App\Http\Controllers\Controller;
7
use App\Model\Product\ProductCategory;
8
9
class CategoryController extends Controller
10
{
11
    public function __construct()
12
    {
13
        $this->middleware('auth');
14
        $this->middleware('admin');
15
    }
16
    /**
17
     * Display a listing of the resource.
18
     *
19
     * @return \Illuminate\Http\Response
20
     */
21
    public function index()
22
    {
23
        return view('themes.default1.category.index');
24
    }
25
26
    /**
27
     * Show the form for creating a new resource.
28
     *
29
     * @return \Illuminate\Http\Response
30
     */
31
    public function create()
32
    {
33
        //
34
    }
35
36
    /**
37
     * Store a newly created resource in storage.
38
     *
39
     * @param  \Illuminate\Http\Request  $request
40
     * @return \Illuminate\Http\Response
41
     */
42
    public function store(Request $request)
43
    {
44
       try{
45
       $productCat = new ProductCategory(); 
46
       $productCategory = $productCat->fill($request->input())->save();
47
       return redirect()->back()->with('success',\Lang::get('message.saved-successfully'));
48
       }catch (\Exception $ex)
49
       {
50
        dd($ex);
51
        return redirect()->back()->with('fails',$ex->getMessage());
52
       }  
53
54
    }
55
56
    /**
57
     * Display the specified resource.
58
     *
59
     * @param  int  $id
60
     * @return \Illuminate\Http\Response
61
     */
62
    public function show($id)
63
    {
64
        //
65
    }
66
67
    /**
68
     * Show the form for editing the specified resource.
69
     *
70
     * @param  int  $id
71
     * @return \Illuminate\Http\Response
72
     */
73
    public function edit($id)
74
    {
75
        //
76
    }
77
78
    /**
79
     * Update the specified resource in storage.
80
     *
81
     * @param  \Illuminate\Http\Request  $request
82
     * @param  int  $id
83
     * @return \Illuminate\Http\Response
84
     */
85
    public function update(Request $request, $id)
86
    {
87
        //
88
    }
89
90
    /**
91
     * Remove the specified resource from storage.
92
     *
93
     * @param  int  $id
94
     * @return \Illuminate\Http\Response
95
     */
96
    public function destroy($id)
97
    {
98
        //
99
    }
100
}
101