public function run() { $params = Parameter::lists('id'); $tags = Tag::all(); foreach ($tags as $tag) { $tag->params()->attach($randValues = array_intersect_key($params, array_flip(array_rand($params, 2)))); } }
public function boot(Router $router) { parent::boot($router); $router->bind('tags', function ($slug) { return Tag::where('slug', $slug)->firstOrFail(); }); $router->bind('options', function ($slug) { return Option::where('slug', $slug)->firstOrFail(); }); $router->bind('parameters', function ($slug) { return Parameter::where('slug', $slug)->firstOrFail(); }); }
public function destroy(Parameter $parameter) { $parameter->delete(); // flash()->overlay('Service has been deleted', 'Success'); return redirect('parameters'); }