app/Http/Controllers/SiteController.php
/**
     *
     * Find enterprise and user thanks based in keywords given by the user.
     *
     * @param Request $request
     *
     * @return Response
     * 
     */
Find enterprise and user thanks based in keywords given by the user.
@param Request $request

@return Response
Find enterprise and user thanks based in keywords given by the user . @param Request $request @return Response
public function findThanks(Request $request)
    {
        $data = array(
            'enterprises' => Enterprise::all(),
            'enterpriseThanks' => DB::table('enterprise_thanks')->join('enterprises', 'enterprises.id', '=', 'enterprise_thanks.enterprise_id')->join('users', 'users.id', '=', 'enterprise_thanks.user_id')->select('users.name AS user', 'photo', 'enterprises.name AS enterprise', 'content', 'logo', DB::raw('DATE_FORMAT(thanksDateTime, "%d/%m/%Y") AS date'))->where('enterprise_thanks.content', 'LIKE', "%{$request->search}%")->orWhere('enterprises.name', 'LIKE', "%{$request->search}%")->orderBy('thanksDateTime', 'desc')->get(),
            'page' => 'search'
        );
        return view('site.index')->with('data', $data);
    }
public function findThanks ( Request $ request ) { $ data = array ( 'enterprises' => Enterprise :: all ( ) , 'enterpriseThanks' => DB :: table ( 'enterprise_thanks' ) -> join ( 'enterprises' , 'enterprises.id' , '=' , 'enterprise_thanks.enterprise_id' ) -> join ( 'users' , 'users.id' , '=' , 'enterprise_thanks.user_id' ) -> select ( 'users.name AS user' , 'photo' , 'enterprises.name AS enterprise' , 'content' , 'logo' , DB :: raw ( 'DATE_FORMAT(thanksDateTime, "%d/%m/%Y") AS date' ) ) -> where ( 'enterprise_thanks.content' , 'LIKE' , " % { $ request -> search } % " ) -> orWhere ( 'enterprises.name' , 'LIKE' , " % { $ request -> search } % " ) -> orderBy ( 'thanksDateTime' , 'desc' ) -> get ( ) , 'page' => 'search' ) ; return view ( 'site.index' ) -> with ( 'data' , $ data ) ; }
Find enterprise and user thanks based in keywords given by the user.
Find enterprise and user thanks based in keywords given by the user .