Beispiel #1
0
 public function search(Request $request)
 {
     $keyword = $request->get('keyword');
     $items = Deal::where('name', 'like', '%' . $keyword . '%');
     return view('frontend.category.category')->with('products', $items->paginate(10))->with('categories', Category::all());
 }
Beispiel #2
0
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Model\Category;
use App\Model\Deal;
use App\Model\Partner;
Route::group(['prefix' => 'api', 'namespace' => 'Api', 'middleware' => 'cors'], function () {
    Route::get('/categories', function () {
        $categories = Category::where('parent_id', null)->get();
        return $categories;
    });
    Route::get('/categories/{id}', function ($id) {
        return Deal::where('partner_id', $id)->get();
    });
});
Route::group(['namespace' => 'Frontend'], function () {
    Route::get('/', 'MainController@index');
    Route::get('/index', 'MainController@index');
    Route::get('/danh-muc/{category_id}', 'MainController@listProductByCategory');
    Route::get('/san-pham/{deal_id}', 'MainController@productByCategory');
    Route::post('/search', 'MainController@search');
    Route::post('/san-pham/{deal_id}', 'MainController@addToCart');
    Route::get('/gio-hang', 'MainController@getCarts');
    Route::post('/gio-hang/{dea_id}', 'MainController@removeCart');
    Route::post('/gio-hang/giam/{deal_id}', 'MainController@minusCart');
    Route::get('/thanh-toan', 'MainController@getCheckout');
    Route::post('/thanh-toan', 'MainController@postCheckout');
    Route::get('/thanh-toan-paypal', ['uses' => 'PaymentController@getCheckout', 'as' => 'paypal']);
Beispiel #3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     return Deal::where('id', $id)->get()->first()->images();
 }