/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tags')->truncate();
     DB::table('taggables')->truncate();
     factory(App\Associations\Tag::class, 10)->create();
     foreach (Article::all() as $article) {
         $article->tags()->sync([rand(1, 10), rand(1, 10), rand(1, 10)]);
     }
     DB::table('images')->truncate();
     DB::table('imagables')->truncate();
     factory(App\Associations\Image::class, 10)->create();
     foreach (Article::all() as $article) {
         $article->images()->sync([rand(1, 10), rand(1, 10), rand(1, 10)]);
     }
     DB::table('favourites')->truncate();
     foreach (User::all() as $user) {
         $article = Article::find(rand(1, 10));
         $article2 = Article::find(rand(1, 10));
         Favourite::create(['user_id' => $user->id, 'favourable_id' => $article->id, 'favourable_type' => get_class($article)]);
         Favourite::create(['user_id' => $user->id, 'favourable_id' => $article2->id, 'favourable_type' => get_class($article2)]);
         // @todo: favourite a Product or two here
     }
 }
 public function selectAll()
 {
     return User::all();
 }
Beispiel #3
0
    Route::get('example/cart/insert/{product}/{quantity}', 'ExampleController@cartInsertProduct');
    Route::get('example/cart/update/{product}/{quantity}', 'ExampleController@cartUpdateProduct');
    Route::get('example/cart/delete/{product}', 'ExampleController@cartDeleteProduct');
    Route::get('example/checkout', 'ExampleController@checkoutIndex');
    Route::get('example/checkout/complete', 'ExampleController@checkoutComplete');
    /** ----------------------------------------
     *  Routes for registration and auth
     *  ----------------------------------------
     */
    Route::get('login-register', ['as' => 'login-register', 'uses' => 'Auth\\AuthController@getLoginRegisterPage']);
    Route::post('register', ['as' => 'post.register', 'uses' => 'Auth\\RegistrationController@postRegister']);
    Route::get('confirm-registration/{confirmationToken}', ['as' => 'confirm-registration', 'uses' => 'Auth\\RegistrationController@getConfirmRegistration']);
    Route::post('login', ['as' => 'post.login', 'uses' => 'Auth\\AuthController@postLogin']);
    Route::get('logout', ['as' => 'logout', 'uses' => 'Auth\\AuthController@getLogout']);
    /*
     * Social authentication routes
     */
    Route::get('social-login', ['as' => 'social-login', 'uses' => 'Auth\\SocialController@redirectToProvider']);
    Route::get('social/callback', 'Auth\\SocialController@handleProviderCallback');
    Route::get('social/callback/facebook', 'Auth\\SocialController@handleFacebookCallback');
    Route::get('social/callback/twitter', 'Auth\\SocialController@handleTwitterCallback');
    Route::get('example/async', function () {
        return \App\Accounts\User::all();
    });
    /*
     * Management routes
     */
    Route::get('manage-shop', ['as' => 'manager|manage-shop', 'uses' => 'ManagementController@getDashboard']);
    Route::resource('article', 'ArticlesController');
    Route::post('article-upload-image', ['as' => 'post.article-upload-images', 'uses' => 'ArticlesController@postUploadImages']);
});