app/Http/Controllers/studentcontroller.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)
    {
        $getname=request('name');
        $getemail=request('email');
        $getphno=request('phone_no');
        $getquali=request('qualification');
        $getpass=request('password');
        $getcpass=request('confirm_password');
       $this->validate($request, [
        'name'=>'required',
        'email'=>'required|email',
        'phone_no'=>'required',
        'qualification'=>'required',
        'password'=>'required|min:5|max:15 ',
        'confirm_password'=>'required|min:5|max:15 '
       ]);
        if($getcpass == $getpass)
        {
            $stu=new student();
            $user= new userlog();
            $stu->name=$getname;
            $stu->email=$getemail;
            $stu->phone=$getphno;
            $stu->qualification=$getquali;
            $stu->password=$getpass;
            $stu->status="1";
            $user->name=$getname;
            $user->mailid=$getemail;
            $user->password=$getpass;
            $user->usertype="student";
            $stu->save();
            $user->save();
            if($stu && $user){
                $i=student::select('name')->where('email','like',"$getemail")->first();
                $request->session()->put('sname',$i);
                echo "<script>alert('Success.. Student Added.....');window.location='/scheduleview';</script>"; 
            }
            else{
                echo "<script>alert('Something went Wrong.......');window.location='/';</script>"; 
            }
        }
        else{
            echo "<script>alert('Password is not correct......');window.location='/';</script>"; 
        }
    }
public function store ( Request $ request ) { $ getname = request ( 'name' ) ; $ getemail = request ( 'email' ) ; $ getphno = request ( 'phone_no' ) ; $ getquali = request ( 'qualification' ) ; $ getpass = request ( 'password' ) ; $ getcpass = request ( 'confirm_password' ) ; $ this -> validate ( $ request , [ 'name' => 'required' , 'email' => 'required|email' , 'phone_no' => 'required' , 'qualification' => 'required' , 'password' => 'required|min:5|max:15 ' , 'confirm_password' => 'required|min:5|max:15 ' ] ) ; if ( $ getcpass == $ getpass ) { $ stu = new student ( ) ; $ user = new userlog ( ) ; $ stu -> name = $ getname ; $ stu -> email = $ getemail ; $ stu -> phone = $ getphno ; $ stu -> qualification = $ getquali ; $ stu -> password = $ getpass ; $ stu -> status = " 1 " ; $ user -> name = $ getname ; $ user -> mailid = $ getemail ; $ user -> password = $ getpass ; $ user -> usertype = " student " ; $ stu -> save ( ) ; $ user -> save ( ) ; if ( $ stu && $ user ) { $ i = student :: select ( 'name' ) -> where ( 'email' , 'like' , " $ getemail " ) -> first ( ) ; $ request -> session ( ) -> put ( 'sname' , $ i ) ; echo " <script>alert('Success.. Student Added.....');window.location='/scheduleview';</script> " ; } else { echo " <script>alert('Something went Wrong.......');window.location='/';</script> " ; } } else { echo " <script>alert('Password is not correct......');window.location='/';</script> " ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
// echo "successfully added"; //return redirect('/scheduleview');