app/Http/Controllers/Admin/MailLogsController.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, [
            'mail_to'   => 'nullable|string'
        ]);
        $maillogs = MailLog::all();
        if (isset($request_data['mail_to']))
        {
            $maillogs = MailLog::where('mail_to', 'like', "%" . $request_data['mail_to'] . "%")->get();
        } else $request_data['mail_to'] = "";
        if (count($maillogs) == 0)
        {
            $request->session()->flash('error', "No search Result!");
        }
        $data = [
            'maillogs'  => $maillogs,
            'old'       => $request_data
        ];
        return view('admin.maillogs.index')->with('data', $data);
    }
public function index ( Request $ request ) { $ request_data = $ this -> validate ( $ request , [ 'mail_to' => 'nullable|string' ] ) ; $ maillogs = MailLog :: all ( ) ; if ( isset ( $ request_data [ 'mail_to' ] ) ) { $ maillogs = MailLog :: where ( 'mail_to' , 'like' , " % " . $ request_data [ 'mail_to' ] . " % " ) -> get ( ) ; } else $ request_data [ 'mail_to' ] = " " ; if ( count ( $ maillogs ) == 0 ) { $ request -> session ( ) -> flash ( 'error' , " No search Result! " ) ; } $ data = [ 'maillogs' => $ maillogs , 'old' => $ request_data ] ; return view ( 'admin.maillogs.index' ) -> with ( 'data' , $ data ) ; }
Display a listing of the resource.
Display a listing of the resource .