コード例 #1
0
ファイル: routes.php プロジェクト: bluecipherz/gl-ct
    $list = implode('', $html);
    $options = HTML::attributes($options);
    return "<select{$options}>{$list}</select>";
});
Route::get('hell', function (Request $request) {
    //    $this->app['auth']->admin()->setUser(\App\Customer::find(1));
    //    throw new \App\Exceptions\LoginException($request);
    //    $credentials = [
    //        'email' => '*****@*****.**',
    //        'password' => 'asd123.'
    //    ];
    //    $re = Auth::customer()->attempt($credentials);
    //    echo 'ok ' . $re;
    $cat = App\Category::find(2);
    $cats = [];
    echo response()->json(App\Category::hasChildren()->get());
});
Route::get('slurp', function (App\Repositories\HomeRepository $c) {
    $items = App\Advertisement::with('images')->where('id', '>', 100)->select('id', 'title', 'description', 'price', DB::raw('0 as type'));
    $products = App\Globex::with('images')->where('id', '>', 998)->select('id', 'title', 'description', 'price', DB::raw('1 as type'));
    return response()->json($items->union($products->getQuery())->get());
});
Route::get('ajax', function () {
    return 'ookay';
});
Route::get('motors', function () {
    $data = ['cats' => App\Category::whereDepth(2)->lists('name', 'id'), 'motors' => App\Motor::all()];
    return view('temp.motors', $data);
});
Route::post('motors', function () {
    App\Motor::create(['title' => Input::get('title'), 'price' => Input::get('price'), 'stock' => Input::get('stock'), 'brand' => Input::get('brand'), 'description' => Input::get('description'), 'category_id' => Input::get('category_id'), 'chassis_no' => Input::get('chassis_no'), 'model' => Input::get('model'), 'color' => Input::get('color')]);