/** * @return mixed */ public function getAjaxTag() { $value = Tag::whereSlug($_GET['tag_id'])->first()->toJson(); return $value; }
/** * @param $slug * @return mixed */ public static function getProduct($slug) { $value = Tag::whereSlug($slug)->first(); return Product::whereTag_id($value['id'])->get(); }
/** * [newProduct description] * @param [type] $slug [description] * @return [type] [description] */ public function newProduct($slug) { $data['tag_id'] = Tag::whereSlug($slug)->first(); $manufactures = Manufacture::all(); foreach ($manufactures as $manufacture) { $mf[$manufacture->id] = $manufacture->name; } $data['content_header'] = "Add New " . ucfirst($slug) . " Product"; $data['url'] = URL::route('product.new.save', $slug); $data['submit'] = "Add New Product"; $data['manufacture'] = $mf; return View::make('admin.product.new', $data); }
<?php Route::bind('posts', function ($value, $route) { return Post::whereSlug($value)->firstOrFail(); }); Route::bind('series', function ($value, $route) { return Series::whereSlug($value)->firstOrFail(); }); Route::bind('tags', function ($value, $route) { return Tag::whereSlug($value)->firstOrFail(); }); Route::bind('projects', function ($value, $route) { return Project::whereSlug($value)->firstOrFail(); }); Route::model('users', 'User');
public static function doEdit($array) { $update = Tag::whereSlug($array['tag_edit_slug'])->update(array('name' => $array['name'], 'template' => $array['template'], 'slug' => Str::slug($array['name']))); return; }