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