示例#1
0
 protected function loadItems()
 {
     if (!($category = Category::find($this->property('category')))) {
         return Item::paginate($this->property('itemsPerPage'), $this->property('pageNumber'));
     }
     return $category->items()->paginate($this->property('itemsPerPage'), $this->property('pageNumber'));
 }
 public function run()
 {
     //
     // @todo
     //
     // Add a Welcome post or something
     //
     Category::create(['name' => 'Uncategorized']);
 }
示例#3
0
 public function index_onDelete()
 {
     if ($checkedIds = post('checked')) {
         foreach ($checkedIds as $itemId) {
             if (!($table = Category::find($itemId))) {
                 continue;
             }
             $table->delete();
         }
         Flash::success(Lang::get('backend::lang.form.delete_success', ['name' => Lang::get('arrizalamin.portfolio::lang.controller.form.categories.title')]));
     }
     return $this->listRefresh();
 }
 public function run()
 {
     // exit when items are found
     if (Item::count()) {
         return false;
     }
     /**
      * Add example category
      */
     $ec = Category::create(['name' => 'Examples', 'slug' => 'examples']);
     /**
      * Add example tag
      */
     $t1 = Tag::create(['name' => 'one']);
     /**
      * Add example item
      */
     $i1 = Item::create(['category_id' => $ec->id, 'title' => 'Proactively disseminate', 'slug' => 'proactively', 'description' => 'Proactively disseminate parallel markets after open-source e-services. Quickly administrate goal-oriented sources through turnkey human capital. Intrinsicly transition installed base schemas with reliable resources. Proactively leverage other\'s compelling mindshare with interoperable applications. Holisticly aggregate transparent metrics through just in time value. Conveniently target pandemic paradigms through leading-edge intellectual capital. Authoritatively create next-generation products rather than reliable platforms. Dramatically predominate robust materials rather than principle-centered innovation. Quickly simplify market positioning niches through equity invested outsourcing. Intrinsicly integrate progressive niche markets.']);
     $i1->tags()->attach($t1->id);
     //TODO: find a way to attach sample images to the items.
 }
示例#5
0
 /**
  * Get the selected category object for further processing.
  *
  * @param $selectedCategory
  * @param bool|false $bySlug
  * @return mixed
  */
 protected function loadItemsByCategory($selectedCategory, $bySlug = false)
 {
     if ($bySlug) {
         $category = Category::where('slug', '=', $selectedCategory)->first();
     } else {
         $category = Category::find($selectedCategory);
     }
     return $category;
 }