app/Http/Controllers/ExtraWordsController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request, $shopId)
    {
        if (Auth::check() and Auth::user()->type == 'admin') {
			$shop = Shop::find($shopId);
			$words = ExtraWords::create([
					'title' => $request['title'], 
					'body' => $request['body'],
					'shop_id' => $shop->id]);
			$shop -> save();
			return redirect()->route('extrawords.table', [$shop->id]);
		}
		else {
			return redirect('/login');
		}
    }
public function store ( Request $ request , $ shopId ) { if ( Auth :: check ( ) and Auth :: user ( ) -> type == 'admin' ) { $ shop = Shop :: find ( $ shopId ) ; $ words = ExtraWords :: create ( [ 'title' => $ request [ 'title' ] , 'body' => $ request [ 'body' ] , 'shop_id' => $ shop -> id ] ) ; $ shop -> save ( ) ; return redirect ( ) -> route ( 'extrawords.table' , [ $ shop -> id ] ) ; } else { return redirect ( '/login' ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .