Esempio n. 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $model = new \App\Article();
     $article = $model->getArticle(['id' => $id]);
     $portal = new \App\Portal();
     $portals = $portal->getPortals();
     return view('admin/publish', ['article' => $article, 'portals' => $portals]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 0; $i < 5; $i++) {
         $user = new App\Article();
         $user->title = "Titolo_{$i}";
         $user->post = "Descrizione_{$i}";
         $user->published_at = Carbon\Carbon::now();
         $user->save();
     }
 }
Esempio n. 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 1; $i < 500; $i++) {
         $blog = new \App\Article(['writer_id' => 1, 'title' => 'Blog ' . $i, 'slug' => str_slug('Blog ' . $i), 'summary' => 'Lorem ipsum Pariatur labore Ut consequat aliquip sint eiusmod ea exercitation in ad magna in veniam elit dolor eu pariatur reprehenderit aliqua et esse.', 'content' => '
                                             <p>Lorem ipsum Aliquip aliqua anim in et in labore ut laboris cupidatat dolor dolor aliquip quis aliqua consectetur sit aliquip enim Ut aliquip nulla id ea eu exercitation dolor id cupidatat anim ut aliqua qui amet nisi in aliquip ad sed Excepteur ullamco ut eiusmod cupidatat proident reprehenderit eiusmod aliqua Ut officia Duis aliqua ullamco non reprehenderit ea in velit ad mollit sit consequat culpa consectetur in mollit in aute labore nostrud ea aute Excepteur dolore adipisicing voluptate consequat qui in ea amet aute culpa elit proident dolore mollit tempor non dolor elit aliquip Ut adipisicing tempor elit dolore elit dolor occaecat dolore quis eiusmod sit id exercitation consequat occaecat elit ea consequat veniam Ut ut Excepteur tempor quis anim commodo nisi in do officia Ut enim officia ullamco Ut aute non Excepteur ut ut eu elit est aute ut Duis mollit aliqua laborum ea magna Ut eiusmod velit labore eu qui do officia incididunt non ea in quis in ullamco reprehenderit culpa labore dolore elit deserunt culpa ad laborum cillum sint nisi dolore ad velit aliqua consequat laboris voluptate aute ex dolor minim commodo labore incididunt veniam sunt elit amet dolore aliquip eu nostrud dolor non irure ea aute tempor laborum incididunt sed mollit enim fugiat irure fugiat aute anim do in velit culpa dolore Duis labore culpa laborum Excepteur cillum cupidatat ut dolore esse laborum elit eiusmod officia commodo consectetur consequat aute ea id commodo exercitation nisi occaecat est deserunt dolor proident exercitation ut nostrud cupidatat fugiat minim dolore veniam deserunt nostrud adipisicing minim cupidatat</p>.
                                             <p>Lorem ipsum Aliquip aliqua anim in et in labore ut laboris cupidatat dolor dolor aliquip quis aliqua consectetur sit aliquip enim Ut aliquip nulla id ea eu exercitation dolor id cupidatat anim ut aliqua qui amet nisi in aliquip ad sed Excepteur ullamco ut eiusmod cupidatat proident reprehenderit eiusmod aliqua Ut officia Duis aliqua ullamco non reprehenderit ea in velit ad mollit sit consequat culpa consectetur in mollit in aute labore nostrud ea aute Excepteur dolore adipisicing voluptate consequat qui in ea amet aute culpa elit proident dolore mollit tempor non dolor elit aliquip Ut adipisicing tempor elit dolore elit dolor occaecat dolore quis eiusmod sit id exercitation consequat occaecat elit ea consequat veniam Ut ut Excepteur tempor quis anim commodo nisi in do officia Ut enim officia ullamco Ut aute non Excepteur ut ut eu elit est aute ut Duis mollit aliqua laborum ea magna Ut eiusmod velit labore eu qui do officia incididunt non ea in quis in ullamco reprehenderit culpa labore dolore elit deserunt culpa ad laborum cillum sint nisi dolore ad velit aliqua consequat laboris voluptate aute ex dolor minim commodo labore incididunt veniam sunt elit amet dolore aliquip eu nostrud dolor non irure ea aute tempor laborum incididunt sed mollit enim fugiat irure fugiat aute anim do in velit culpa dolore Duis labore culpa laborum Excepteur cillum cupidatat ut dolore esse laborum elit eiusmod officia commodo consectetur consequat aute ea id commodo exercitation nisi occaecat est deserunt dolor proident exercitation ut nostrud cupidatat fugiat minim dolore veniam deserunt nostrud adipisicing minim cupidatat</p>.
                                             <p>Lorem ipsum Aliquip aliqua anim in et in labore ut laboris cupidatat dolor dolor aliquip quis aliqua consectetur sit aliquip enim Ut aliquip nulla id ea eu exercitation dolor id cupidatat anim ut aliqua qui amet nisi in aliquip ad sed Excepteur ullamco ut eiusmod cupidatat proident reprehenderit eiusmod aliqua Ut officia Duis aliqua ullamco non reprehenderit ea in velit ad mollit sit consequat culpa consectetur in mollit in aute labore nostrud ea aute Excepteur dolore adipisicing voluptate consequat qui in ea amet aute culpa elit proident dolore mollit tempor non dolor elit aliquip Ut adipisicing tempor elit dolore elit dolor occaecat dolore quis eiusmod sit id exercitation consequat occaecat elit ea consequat veniam Ut ut Excepteur tempor quis anim commodo nisi in do officia Ut enim officia ullamco Ut aute non Excepteur ut ut eu elit est aute ut Duis mollit aliqua laborum ea magna Ut eiusmod velit labore eu qui do officia incididunt non ea in quis in ullamco reprehenderit culpa labore dolore elit deserunt culpa ad laborum cillum sint nisi dolore ad velit aliqua consequat laboris voluptate aute ex dolor minim commodo labore incididunt veniam sunt elit amet dolore aliquip eu nostrud dolor non irure ea aute tempor laborum incididunt sed mollit enim fugiat irure fugiat aute anim do in velit culpa dolore Duis labore culpa laborum Excepteur cillum cupidatat ut dolore esse laborum elit eiusmod officia commodo consectetur consequat aute ea id commodo exercitation nisi occaecat est deserunt dolor proident exercitation ut nostrud cupidatat fugiat minim dolore veniam deserunt nostrud adipisicing minim cupidatat</p>.
                                             <p>Lorem ipsum Aliquip aliqua anim in et in labore ut laboris cupidatat dolor dolor aliquip quis aliqua consectetur sit aliquip enim Ut aliquip nulla id ea eu exercitation dolor id cupidatat anim ut aliqua qui amet nisi in aliquip ad sed Excepteur ullamco ut eiusmod cupidatat proident reprehenderit eiusmod aliqua Ut officia Duis aliqua ullamco non reprehenderit ea in velit ad mollit sit consequat culpa consectetur in mollit in aute labore nostrud ea aute Excepteur dolore adipisicing voluptate consequat qui in ea amet aute culpa elit proident dolore mollit tempor non dolor elit aliquip Ut adipisicing tempor elit dolore elit dolor occaecat dolore quis eiusmod sit id exercitation consequat occaecat elit ea consequat veniam Ut ut Excepteur tempor quis anim commodo nisi in do officia Ut enim officia ullamco Ut aute non Excepteur ut ut eu elit est aute ut Duis mollit aliqua laborum ea magna Ut eiusmod velit labore eu qui do officia incididunt non ea in quis in ullamco reprehenderit culpa labore dolore elit deserunt culpa ad laborum cillum sint nisi dolore ad velit aliqua consequat laboris voluptate aute ex dolor minim commodo labore incididunt veniam sunt elit amet dolore aliquip eu nostrud dolor non irure ea aute tempor laborum incididunt sed mollit enim fugiat irure fugiat aute anim do in velit culpa dolore Duis labore culpa laborum Excepteur cillum cupidatat ut dolore esse laborum elit eiusmod officia commodo consectetur consequat aute ea id commodo exercitation nisi occaecat est deserunt dolor proident exercitation ut nostrud cupidatat fugiat minim dolore veniam deserunt nostrud adipisicing minim cupidatat</p>.
                                             ', 'published_at' => \Carbon\Carbon::now()]);
         if (!$blog->save()) {
             dd($blog->getErrors());
         }
         $img = rand(1, 12);
         $blog->images()->saveMany([new Image(['name' => 'SmallImage', 'path' => 'http://localhost:8000/images/43/' . $img . '.jpg', 'title' => $blog->title, 'description' => $blog->summary]), new Image(['name' => 'LargeImage', 'path' => 'http://localhost:8000/images/43/' . $img . '.jpg', 'title' => $blog->title, 'description' => $blog->summary])]);
     }
 }
 public function run()
 {
     App\Article::create(["title" => "first article", "body" => "first article body", "published_at" => Carbon\Carbon::now(), "user_id" => 1]);
     App\Article::create(["title" => "second article", "body" => "second article body", "published_at" => Carbon\Carbon::now(), "user_id" => 1]);
     App\Article::create(["title" => "third article", "body" => "third article body", "published_at" => Carbon\Carbon::now(), "user_id" => 1]);
     App\Article::create(["title" => "a future article", "body" => "a future article body", "published_at" => Carbon\Carbon::now()->addDays(8), "user_id" => 1]);
     App\Article::create(["title" => "another future article", "body" => "another future article body", "published_at" => Carbon\Carbon::now()->addDays(18), "user_id" => 1]);
 }
Esempio n. 5
0
 public function run()
 {
     App\Article::truncate();
     factory(App\Article::class, 20)->create();
 }
Esempio n. 6
0
/*
 * 修改器
 * */
Route::get('xgq', function () {
    $r = App\Article::find(1);
    $r->intro = 'ELICK';
    $r->save();
    dump($r);
});
/**
 * 日期修改器
 */
Route::get('rqxgq', function () {
    //只有在模型文件里设置 $dates 才可以直接使用Carbon类型
    //自带的created_at和updated_at不受限制 也就是不放在数组里也没关系
    $article = App\Article::find(1);
    return $article->published_at->getTimestamp();
});
/**
 * 序列号
 */
Route::get('xlh', function () {
    $user = App\User::find(1);
    //return $user->toJson();
    //return (string)$user;
    //隐藏属性这样是可以看见的
    //dump($user->password);
    return App\User::all();
});
// 认证路由...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Esempio n. 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /*
      * Prepare seeding
      */
     $faker = Faker::create();
     if (config('database.default') != 'sqlite') {
         DB::statement('SET FOREIGN_KEY_CHECKS=0');
     }
     Model::unguard();
     /*
      * Seeding users table
      */
     App\User::truncate();
     factory(App\User::class)->create(['name' => 'John Doe', 'email' => '*****@*****.**', 'password' => bcrypt('password')]);
     factory(App\User::class, 9)->create();
     $this->command->info('users table seeded');
     /**
      * Seeding roles table
      */
     Bican\Roles\Models\Role::truncate();
     DB::table('role_user')->truncate();
     $adminRole = Bican\Roles\Models\Role::create(['name' => 'Admin', 'slug' => 'admin']);
     $memberRole = Bican\Roles\Models\Role::create(['name' => 'Member', 'slug' => 'member']);
     App\User::where('email', '!=', '*****@*****.**')->get()->map(function ($user) use($memberRole) {
         $user->attachRole($memberRole);
     });
     App\User::whereEmail('*****@*****.**')->get()->map(function ($user) use($adminRole) {
         $user->attachRole($adminRole);
     });
     $this->command->info('roles table seeded');
     /*
      * Seeding articles table
      */
     App\Article::truncate();
     $users = App\User::all();
     $users->each(function ($user) use($faker) {
         $user->articles()->save(factory(App\Article::class)->make());
         $user->articles()->save(factory(App\Article::class)->make());
     });
     $this->command->info('articles table seeded');
     /**
      * Seeding comments table
      */
     App\Comment::truncate();
     $articles = App\Article::all();
     $articles->each(function ($article) use($faker, $users) {
         $article->comments()->save(factory(App\Comment::class)->make(['author_id' => $faker->randomElement($users->lists('id')->toArray())]));
     });
     $this->command->info('comments table seeded');
     /*
      * Seeding tags table
      */
     App\Tag::truncate();
     DB::table('article_tag')->truncate();
     $rawTags = ['General', 'Laravel', 'Lumen', 'Eloquent', 'Servers', 'Tips', 'Lesson Feedback'];
     foreach ($rawTags as $tag) {
         App\Tag::create(['name' => $tag, 'slug' => str_slug($tag)]);
     }
     $tags = App\Tag::all();
     foreach ($articles as $article) {
         $article->tags()->attach($faker->randomElements($tags->lists('id')->toArray(), $faker->randomElement([1, 2, 3])));
     }
     $this->command->info('tags table seeded');
     /*
      * Seeding attachments table
      */
     App\Attachment::truncate();
     if (!File::isDirectory(attachment_path())) {
         File::deleteDirectory(attachment_path(), true);
     }
     $articles->each(function ($article) use($faker) {
         $article->attachments()->save(factory(App\Attachment::class)->make());
     });
     $files = App\Attachment::lists('name');
     if (!File::isDirectory(attachment_path())) {
         File::makeDirectory(attachment_path(), 777, true);
     }
     foreach ($files as $file) {
         File::put(attachment_path($file), '');
     }
     $this->command->info('attachments table seeded');
     /**
      * Close seeding
      */
     Model::reguard();
     if (config('database.default') != 'sqlite') {
         DB::statement('SET FOREIGN_KEY_CHECKS=1');
     }
 }
Esempio n. 8
0
<?php

/**
 * Created by PhpStorm.
 * User: Jesus
 * Date: 7/10/2015
 * Time: 6:52 PM
 */
require 'fs_folders/php_functions/Helper/helper.php';
$db = new Database();
$look = new Look($this->mno, $db);
$article = new \App\Article($db, $this->mno);
?>
 <div class="header-dropdown-wrapper"   >

    <!-- LOOK-->
     <div class="header-dropdown-container"   id="dropdown-header-look"  >
         <ul class="header-dropdown-ul-1-container"    >
              <li>
                  <a href="look?category=alllooks">
                      <div>
                          <div>
                              <br>
                              <br>
                              <span>All Looks</span>
                          </div>
                      </div>
                  </a>
              </li>

              <li>
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $tag_ids = [];
     $users = [];
     $nodes = [];
     static::nodeRecurse($nodes);
     for ($a = 1; $a <= 5; $a++) {
         $tag = new \App\Tag();
         $faker->seed($a + 10);
         $tag->name = $faker->word;
         $tag->save();
         $tag_ids[] = $tag->id;
     }
     $faker->unique(true);
     for ($b = 1; $b <= 20; $b++) {
         $user = new \App\User();
         $faker->seed($a);
         $user->name = $faker->unique()->userName;
         $user->email = $faker->unique()->email;
         $user->password = $faker->password;
         $user->save();
         $users[] = $user;
     }
     foreach ($users as $user) {
         $faker->seed($user->id);
         if ($faker->boolean(40)) {
             // Author
             $author = new \App\Author();
             $author->user()->associate($user);
             $author->name = $faker->name;
             $author->save();
             if ($faker->boolean(50)) {
                 $number_of_likes = $faker->numberBetween(1, count($users));
                 $faker->unique(true);
                 for ($c = 1; $c <= $number_of_likes; $c++) {
                     $like = new \App\Like();
                     $user_key = $faker->unique()->randomElement(array_keys($users));
                     $like->user()->associate($users[$user_key]);
                     $like->likeable()->associate($author);
                     $like->save();
                 }
             }
             if ($faker->boolean(20)) {
                 $number_of_reports = $faker->numberBetween(1, round(count($users) / 3));
                 $faker->unique(true);
                 for ($d = 1; $d <= $number_of_reports; $d++) {
                     $report = new \App\Report();
                     $user_key = $faker->unique()->randomElement(array_keys($users));
                     $report->user()->associate($users[$user_key]);
                     $report->save();
                     $report->authors()->attach($author);
                 }
             }
             if ($faker->boolean(75)) {
                 // At leat 1 article
                 $article_count = $faker->numberBetween(1, 15);
                 for ($e = 1; $e < $article_count; $e++) {
                     $article = new \App\Article();
                     $article->author()->associate($author);
                     $article->title = $faker->sentence($faker->numberBetween(3, 10));
                     $article->body = $faker->paragraphs($faker->numberBetween(2, 8), true);
                     $article->node()->associate($faker->randomElement($nodes));
                     $article->save();
                     $article->tags()->sync($faker->randomElements($tag_ids, $faker->numberBetween(0, min(3, count($tag_ids)))));
                     if ($faker->boolean(10)) {
                         $number_of_reports = $faker->numberBetween(1, round(count($users) / 3));
                         $faker->unique(true);
                         for ($f = 1; $f <= $number_of_reports; $f++) {
                             $report = new \App\Report();
                             $user_key = $faker->unique()->randomElement(array_keys($users));
                             $report->user()->associate($users[$user_key]);
                             $report->save();
                             $report->articles()->attach($article);
                         }
                     }
                     if ($faker->boolean(90)) {
                         $review = new \App\Review();
                         $user_key = $faker->randomElement(array_keys($users));
                         $review->user()->associate($users[$user_key]);
                         $review->reviewable()->associate($article);
                         $review->save();
                     }
                     if ($faker->boolean(69)) {
                         $number_of_likes = $faker->numberBetween(1, count($users));
                         $faker->unique(true);
                         for ($g = 1; $g <= $number_of_likes; $g++) {
                             $like = new \App\Like();
                             $user_key = $faker->unique()->randomElement(array_keys($users));
                             $like->user()->associate($users[$user_key]);
                             $like->likeable()->associate($article);
                             $like->save();
                         }
                     }
                 }
                 if ($faker->boolean(70)) {
                     // At leat 1 comment
                     $comment_count = $faker->numberBetween(1, 20);
                     for ($h = 1; $h < $comment_count; $h++) {
                         $comment = new \App\Comment();
                         $comment->article()->associate($article);
                         $comment->user()->associate($user);
                         $comment->body = $faker->paragraph(4, true);
                         $comment->save();
                         if ($faker->boolean(15)) {
                             $number_of_reports = $faker->numberBetween(1, round(count($users) / 3));
                             $faker->unique(true);
                             for ($i = 1; $i <= $number_of_reports; $i++) {
                                 $report = new \App\Report();
                                 $user_key = $faker->unique()->randomElement(array_keys($users));
                                 $report->user()->associate($users[$user_key]);
                                 $report->save();
                                 $report->comments()->attach($comment);
                             }
                         }
                         if ($faker->boolean(90)) {
                             $review = new \App\Review();
                             $user_key = $faker->randomElement(array_keys($users));
                             $review->user()->associate($users[$user_key]);
                             $review->reviewable()->associate($comment);
                             $review->save();
                         }
                         if ($faker->boolean(60)) {
                             $number_of_likes = $faker->numberBetween(1, count($users));
                             $faker->unique(true);
                             for ($j = 1; $j <= $number_of_likes; $j++) {
                                 $like = new \App\Like();
                                 $user_key = $faker->unique()->randomElement(array_keys($users));
                                 $like->user()->associate($users[$user_key]);
                                 $like->likeable()->associate($comment);
                                 $like->save();
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 10
0
 function get_languages($lang_id = 0, $lang = '', $query = '')
 {
     $lang_array = ['ge' => 'ქართული', 'en' => 'English', 'ru' => 'Русский'];
     if ($lang_id > 0) {
         $items = empty($query) ? App\Article::select('lang')->where('lang_id', $lang_id)->get() : $query;
         if (count($items) > 0) {
             foreach ($items as $item) {
                 if ($item->lang != $lang) {
                     unset($lang_array[$item->lang]);
                 }
             }
         }
     }
     return $lang_array;
 }
Esempio n. 11
0
 function get_pages($num, $cat = 1)
 {
     global $registry;
     $pg = array();
     if (!is_array($num)) {
         $registry['cat'] = $num;
     } else {
         $registry['cat'] = $cat;
     }
     $pages = Cache::rememberForever('pages_' . $registry['cat'] . '_' . \App::getLocale(), function () {
         global $registry;
         return App\Article::select('id', 'slug', 'title', 'translate_slug')->getone($registry['cat'])->published()->language()->get();
     });
     if (is_array($num) && count($num) > 0) {
         foreach ($pages as $page) {
             if (in_array($page->id, $num)) {
                 $pg[] = $page;
             }
         }
         return $pg;
     } else {
         return $pages;
     }
 }
Esempio n. 12
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::bind('article', function ($slug) {
    return App\Article::where('slug', $slug)->first();
});
Route::get('/', ['as' => 'front', 'uses' => 'ArticleController@index']);
Route::get('/article/{article}', ['as' => 'show', 'uses' => 'ArticleController@show']);
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'auth'], function () {
    Route::get('/', ['as' => 'home', 'uses' => 'AdminHomeController@index']);
    Route::resource('article', 'AdminArticleController');
    Route::resource('category', 'AdminCategoryController');
});
Esempio n. 13
0
    }
    public function addplus($value)
    {
        return $value + 10;
    }
    function getAA()
    {
    }
}
App::bind('BarInterface', function () {
    return new Bar();
});
Route::get('bar', function (BarInterface $bar, Request $request) {
    // \App\Article::create(['title'=>'new','body'=>'New body']);
    //App\Article::where('body','loren inpun')->get();
    return App\Article::where('body', 'loren inpun')->get();
});
Route::get('/', function () {
    return view('welcome');
});
Route::get('home', function () {
    return view('index');
});
Route::get('tagle', function () {
    if (Auth::check()) {
        $user = Auth::user();
        Auth::user()->articles()->save(new \App\Article());
        return $user;
    }
    return "sorry you should authorizaishen";
});
Esempio n. 14
0
    	CREATING NEW ARTICLES
    */
    $article3 = App\Article::create(array('title' => 'How to ride a bike', 'body' => '...'));
    return;
    // second way (never a mass-assignment alert if done this way)
    $article2 = new App\Article();
    $article2->title = 'How to be succesful!';
    $article2->body = 'This is some other body...';
    $article2->save();
    return 'Saved article. It has an id of ' . $article2->id;
    // first way
    $article = App\Article::create(array('title' => 'How to peel potatoes', 'body' => 'This is some body...'));
    return $article->id;
});
Route::get('article', function () {
    $article = new App\Article('How to peel a potato');
    $letter = 'o';
    if ($article->containsLetter($letter)) {
        return 'Contains: ' . $letter;
    }
    return 'Nope';
});
/************************************************************************************/
Route::get('conditional', function () {
    $list = array('Harry', 'Ron', 'Hermione');
    return View::make('hello')->withFriends($list);
});
/**********************************************************************************/
Route::get('home_test', function () {
    $name = DB::Connection()->getDatabaseName();
    return View::make('pages/home')->with('list', ['banana', 'pear', 'apple'])->with('flavors', ['banana', 'pear', 'apple'])->with('name', $name);
 public function compose(View $view)
 {
     $view->with('latest', App\Article::latest()->first());
 }
Esempio n. 16
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.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::model('tasks', 'Task');
Route::model('projects', 'Project');
Route::resource('projects', 'ProjectsController');
Route::resource('projects.tasks', 'TasksController');
Route::bind('tasks', function ($value, $route) {
    return App\Task::whereSlug($value)->first();
});
Route::bind('projects', function ($value, $route) {
    return App\Project::whereSlug($value)->first();
});
Route::model('articles', 'Article');
Route::resource('articles', 'ArticlesController');
Route::bind('articles', function ($value, $route) {
    return App\Article::whereSlug($value)->first();
});
Route::model('userkeys', 'UserKey');
Route::resource('userkeys', 'UserKeyController');
Route::bind('userapikeymapping', function ($value, $route) {
    return App\UserKey::all();
});
Route:
get('display', 'ProjectsController@display');
<?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('/', function () {
    // $ar = App\ArticleTranslation::first();
    // $ar->title_ex = $ar->title;
    // dd($ar);
    // $ar = DB::table('article_translations')->where('locale', '4')->pluck('title');
    $ar = App\Article::first();
    // echo $ar->title;
    // echo $ar;
    dd($ar);
});
Esempio n. 18
0
/**==========================  User    =========================================================================================================================*/
Route::bind('user', function ($name) {
    return App\User::whereName($name)->first();
});
$router->resource('user', 'userController');
/**===========================  Profile  ========================================================================================================================*/
Route::get('account-setting', ['as' => 'account.setting', 'uses' => 'profileController@accountSetting']);
$router->resource('profile', 'profileController');
/**===========================  Profile  ========================================================================================================================*/
$router->resource('admin', 'adminController');
/**========================  Article ===========================================================================================================================*/
Route::bind('article', function ($slug) {
    return App\Article::whereSlug($slug)->first();
});
Route::bind('user/article', function ($slug) {
    return App\Article::whereSlug($slug)->first();
});
Route::get('All-Articles', ['as' => 'all.article', 'uses' => 'ArticleController@AllArticle']);
$router->resource('article', 'ArticleController');
$router->resource('user/article', 'userArticleController');
Route::get('{user}/article', ['as' => 'user.article.index', 'uses' => 'userController@showArticle']);
/**=============== Review  ====================================================================================================================================*/
$router->resource('review', 'reviewController');
/**=============== Dan lain lain  ====================================================================================================================================*/
Route::bind('AppCategories', function ($name) {
    return App\AppCategory::whereName($name)->first();
});
Route::bind('ArticleCategories', function ($name) {
    return App\ArticleCategory::whereName($name)->first();
});
Route::resource('AppCategories', 'AppCategoryController');
Esempio n. 19
0
 public function run()
 {
     App\Article::create(['title' => 'How to ride a bike', 'body' => '...']);
     App\Article::create(['title' => 'Potetos peeling 4 beginers', 'body' => '...']);
 }