app/Http/Controllers/ClubsController.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)
    {
        $club = new Clubs();
        $club->name = $request->name;
        $club->description = $request->description;
        $club->facebook = $request->facebook;
        $club->phone = $request->phone;
        $club->faction = $request->faction;
        $club->vdo = $request->vdo;
        $error = [];
        if($club->save()){
            $error = [1,'บันทึกชมรมสำเร็จ'];
        }else{
            $error = [0,'เกิดข้อผิดพลาดบางอย่าง โปรดติดต่อแอดมิน'];
        }
        return redirect()->route('clubs.index')->with(['result'=>$error[0],'text'=>$error[1]]);
    }
public function store ( Request $ request ) { $ club = new Clubs ( ) ; $ club -> name = $ request -> name ; $ club -> description = $ request -> description ; $ club -> facebook = $ request -> facebook ; $ club -> phone = $ request -> phone ; $ club -> faction = $ request -> faction ; $ club -> vdo = $ request -> vdo ; $ error = [ ] ; if ( $ club -> save ( ) ) { $ error = [ 1 , 'บันทึกชมรมสำเร็จ']; } else { $ error = [ 0 , 'เกิดข้อผิดพลาดบางอย่าง โปรดติดต่อแอดมิน']; } return redirect ( ) -> route ( 'clubs.index' ) -> with ( [ 'result' => $ error [ 0 ] , 'text' => $ error [ 1 ] ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .