Ejemplo n.º 1
0
 public function run()
 {
     DB::table('category_item')->delete();
     DB::table('categories')->delete();
     App\Category::create(['name' => 'Accommodation']);
     App\Category::create(['name' => 'Movies']);
     App\Category::create(['name' => 'TV shows']);
     App\Category::create(['name' => 'Music']);
     App\Category::create(['name' => 'Food and drink']);
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     App\Category::create(['title' => 'Public']);
     App\Category::create(['title' => 'Private']);
     App\Category::create(['title' => 'Family']);
     $faker = Faker\Factory::create();
     foreach (range(1, 100) as $index) {
         App\Post::create(['title' => $faker->realText(30, 2), 'content' => $faker->realText(100, 2), 'category_id' => App\Category::all()->random()->id]);
     }
     Model::reguard();
 }
Ejemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 3) as $i) {
         App\User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('password')]);
     }
     foreach (range(1, 3) as $i) {
         App\Category::create(['title' => $faker->word]);
     }
     foreach (range(1, 5) as $i) {
         App\Post::create(['title' => $faker->sentence, 'content' => $faker->paragraph, 'category_id' => rand(1, 3), 'user_id' => rand(1, 3)]);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // create a user
     DB::table('users')->insert(['name' => 'arabyalhomsi', 'email' => '*****@*****.**', 'password' => Hash::make('aaa123')]);
     // create a user
     DB::table('users')->insert(['name' => 'ameralhomsi', 'email' => '*****@*****.**', 'password' => Hash::make('aaa123')]);
     // create a category
     App\Category::create(['title' => 'love']);
     App\Category::create(['title' => 'dance']);
     // create an article
     $article = new App\Article(['title' => 'arabylaohmsiasdas', 'body' => 'BlAb ABlAb AbBlAb Ab BlAb Abb', 'views' => 20]);
     $article2 = new App\Article(['title' => 'basdasd', 'body' => 'BlAb ABlAb asdasdasAbBlAb Ab BlAb Abb', 'views' => 30]);
     App\User::all()[0]->articles()->save($article);
     App\Category::all()[0]->articles()->save($article);
     App\Category::all()[1]->articles()->save($article);
     App\User::all()[0]->articles()->save($article2);
     App\Category::all()[0]->articles()->save($article2);
     App\Category::all()[1]->articles()->save($article2);
 }
Ejemplo n.º 5
0
Route::get('/checkout', array("middleware" => "auth", "uses" => 'Front@checkout'));
Route::get('/search/{query}', 'Front@search');
// Authentication routes...
Route::get('auth/login', 'Front@login');
Route::post('auth/login', 'Front@authenticate');
Route::get('auth/logout', 'Front@logout');
// Registration routes...
Route::post('/register', 'Front@register');
// Route::get('hello', 'Hello@index');
// Route::get('/hello/{name}', 'Hello@show');
Route::get('blade', function () {
    $drinks = array('Vodka', 'Gin', 'Brandy');
    return view('page', array("name" => "The Raven", 'day' => 'Friday', 'drinks' => $drinks));
});
Route::get('/insert', function () {
    App\Category::create(array('name' => 'music'));
    return 'Category Added';
});
Route::get('/read', function () {
    $category = new App\Category();
    $get_all_categories = $category->all(array('name', 'id'));
    foreach ($get_all_categories as $category_item) {
        echo $category_item->id . ' ' . $category_item->name . "<br />";
    }
});
Route::get('/update', function () {
    $category = App\Category::find(6);
    $category->name = "HEAVY METAL";
    $category->save();
});
Route::get('/delete', function () {
Ejemplo n.º 6
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| 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.
|
*/
Route::get('/test', 'TestController@hello');
// tao bang
Route::get('/model/admin', function () {
    App\Category::create(array('CateName' => 'Ao'));
});
Route::get('delete', function () {
    $filename = [];
    $filename[] = public_path() . '/upload/images/005.jpg';
    $filename[] = public_path() . '/upload/images/cosplay.jpg';
    foreach ($filename as $row) {
        if (File::exists($row)) {
            File::delete($row);
        }
    }
});
// khai bao controller admin
Route::group(['prefix' => 'admin'], function () {
    Route::resource('product', 'Admin\\ProductController');
    Route::get('product/edit/{slug}/{id}', ['as' => 'admin1.product.edit', 'uses' => 'Admin\\ProductController@edit']);
Ejemplo n.º 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::create(['first_name' => 'Джон', 'family_name' => 'Сноу', 'email' => '*****@*****.**', 'password' => Hash::make('123456'), 'role' => 'administrator']);
     App\Category::create(['category_name' => 'Boards']);
     Product::create(['product_name' => 'Marijka', 'product_content' => 'Ivancho', 'product_price' => 200, 'product_quantity' => 2, 'category_id' => 1]);
 }
Ejemplo n.º 8
0
|
*/
Route::get('/', function () {
    return view('home');
});
Route::get('/about', 'PagesController@about');
Route::get('/post_article', 'PagesController@post_article');
Route::post('/post_article', function () {
    return view('edit_pages/post_article');
});
Route::get('/insert', function () {
    App\Category::create(array('name' => 'Music'));
    return 'category added';
});
Route::get('/insert', function () {
    App\Category::create(array('title' => 'HIROKI'));
    return 'category added';
});
Route::get('/read', function () {
    $category = new App\Category();
    $data = $category->all(array('title', 'id'));
    foreach ($data as $list) {
        echo $list->id . ' ' . $list->title . ' ';
    }
});
Route::get('/update', function () {
    $category = App\Category::find(1);
    $category->title = 'HEAVY METAL';
    $category->save();
    $data = $category->all(array('title', 'id'));
    foreach ($data as $list) {