app/Http/Controllers/Admin/ReligionController.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)
    {
        $rules = [
            'name' => 'required|string|unique:mysql.sch_religions|max:255',
        ];
        $messages = [
            'name.required'   => 'Religion Name is required.',
            'name.string'   => 'Religion Name contain only alphabets.',
            'name.unique'   => 'Religion Name is unique.',
            'name.max'   => 'Religion Name is max of 255 charcters.',
        ];
        $request->validate($rules, $messages);
        $religion = new Religion();
        $religion->name = $request->name;
        $religion->save();
        return redirect(route('admin.religion.index'))->with('success', 'Religion successfully added.');
    }
public function store ( Request $ request ) { $ rules = [ 'name' => 'required|string|unique:mysql.sch_religions|max:255' , ] ; $ messages = [ 'name.required' => 'Religion Name is required.' , 'name.string' => 'Religion Name contain only alphabets.' , 'name.unique' => 'Religion Name is unique.' , 'name.max' => 'Religion Name is max of 255 charcters.' , ] ; $ request -> validate ( $ rules , $ messages ) ; $ religion = new Religion ( ) ; $ religion -> name = $ request -> name ; $ religion -> save ( ) ; return redirect ( route ( 'admin.religion.index' ) ) -> with ( 'success' , 'Religion successfully added.' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .