app/Http/Controllers/Admin/SchoolUserController.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(SchoolRequest $request)
    {
        $user = new User($request->user);
        $user->login = $request->user['mobile'];
        $user->name = $request->user['fname'].' '.$request->user['lname'];
        $user->role = 2;
        $user->save();
        $user->school = $user->id;
        $user->save();
        $user->schoolData()->create($request->school);
        return redirect()->back()->with('success', 'Success Msg!!');
    }
public function store ( SchoolRequest $ request ) { $ user = new User ( $ request -> user ) ; $ user -> login = $ request -> user [ 'mobile' ] ; $ user -> name = $ request -> user [ 'fname' ] . ' ' . $ request -> user [ 'lname' ] ; $ user -> role = 2 ; $ user -> save ( ) ; $ user -> school = $ user -> id ; $ user -> save ( ) ; $ user -> schoolData ( ) -> create ( $ request -> school ) ; return redirect ( ) -> back ( ) -> with ( 'success' , 'Success Msg!!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .