app/Http/Controllers/Admin/RejectedTutorsController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        $request_data = $this->validate($request, [
            't_name'            => 'nullable|string',
            'email'             => 'nullable|email',
            't_date'            => 'nullable|date',
        ]);
        $q = "1=1 ";
        $q.= " and status like 0";
        if (isset($request_data['t_name'])) {
            $q.= " and (fname like '%".$request_data['t_name']."%' or lname like '%" .$request_data['t_name'] . "%') ";
        } else $request_data['t_name'] = "";
        if (isset($request_data['t_date'])) {
            $q.= " and created_at like '%".$request_data['t_date']."%'";
        } else $request_data['t_date'] = "";
        if (isset($request_data['email'])) {
            $q.= " and email like '%".$request_data['email']."%'";
        } else $request_data['email'] = "";
        $tutors = Role::find(config('global.TUTOR_ROLE_ID'))->users()
        ->whereRaw($q)->get();
        $data = [
            'tutors'            => $tutors,
            'old'               => $request_data,
        ];
        if( count($tutors) != 0 ) return view('admin.rejectedtutors.index')->with('data', $data);
        request()->session()->flash('error', "No search results!");
        return view('admin.rejectedtutors.index')->with('data', $data);
    }
public function index ( Request $ request ) { $ request_data = $ this -> validate ( $ request , [ 't_name' => 'nullable|string' , 'email' => 'nullable|email' , 't_date' => 'nullable|date' , ] ) ; $ q = " 1=1  " ; $ q .= "  and status like 0 " ; if ( isset ( $ request_data [ 't_name' ] ) ) { $ q .= "  and (fname like '% " . $ request_data [ 't_name' ] . " %' or lname like '% " . $ request_data [ 't_name' ] . " %')  " ; } else $ request_data [ 't_name' ] = " " ; if ( isset ( $ request_data [ 't_date' ] ) ) { $ q .= "  and created_at like '% " . $ request_data [ 't_date' ] . " %' " ; } else $ request_data [ 't_date' ] = " " ; if ( isset ( $ request_data [ 'email' ] ) ) { $ q .= "  and email like '% " . $ request_data [ 'email' ] . " %' " ; } else $ request_data [ 'email' ] = " " ; $ tutors = Role :: find ( config ( 'global.TUTOR_ROLE_ID' ) ) -> users ( ) -> whereRaw ( $ q ) -> get ( ) ; $ data = [ 'tutors' => $ tutors , 'old' => $ request_data , ] ; if ( count ( $ tutors ) != 0 ) return view ( 'admin.rejectedtutors.index' ) -> with ( 'data' , $ data ) ; request ( ) -> session ( ) -> flash ( 'error' , " No search results! " ) ; return view ( 'admin.rejectedtutors.index' ) -> with ( 'data' , $ data ) ; }
Display a listing of the resource.
Display a listing of the resource .