app/Http/Controllers/dashboard/admin/ClassroomsController.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)
    {
        $this->rules['grade_id'] = ["required"];
        $request->validate($this->rules);
        $data = [
            "name" => $request->post('name'),
            "token" => strtoupper($request->post('token')),
            "grade_id" => $request->post('grade_id')
        ];
        $response = new Classrooms($data);
        if (!$response->save()) return $this->status();
        return $this->status('success', "success add new classroom");
    }
public function store ( Request $ request ) { $ this -> rules [ 'grade_id' ] = [ " required " ] ; $ request -> validate ( $ this -> rules ) ; $ data = [ " name " => $ request -> post ( 'name' ) , " token " => strtoupper ( $ request -> post ( 'token' ) ) , " grade_id " => $ request -> post ( 'grade_id' ) ] ; $ response = new Classrooms ( $ data ) ; if ( ! $ response -> save ( ) ) return $ this -> status ( ) ; return $ this -> status ( 'success' , " success add new classroom " ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .