/** * Run the database seeds. * * @return void */ public function run() { // $faker = Faker\Factory::create('it_IT'); MacroCategory::create(['name' => 'Armi', 'slug' => 'armi', 'category_color' => '#cc33bb', 'fonticon' => '556', 'order' => '1', 'is_published' => 1, 'published_at' => $faker->dateTimeThisYear($max = 'now')]); MacroCategory::create(['name' => 'Accessori', 'slug' => 'accessori', 'category_color' => '#abcdef', 'fonticon' => '400', 'order' => '2', 'is_published' => 1, 'published_at' => $faker->dateTimeThisYear($max = 'now')]); MacroCategory::create(['name' => 'Costumi', 'slug' => 'costumi', 'category_color' => '#cccccc', 'fonticon' => '358', 'order' => '3', 'is_published' => 1, 'published_at' => $faker->dateTimeThisYear($max = 'now')]); }
/** * Bootstrap any application services. * * @return void */ public function boot() { // /*view()->composer('blog.master.layout', function($view){ $view->with('categories', \App\Category::all()); });*/ view()->composer('cosplaydesign.default.layout', function ($view) { $view->with('categories', \App\MacroCategory::all()); }); view()->composer('cosplaydesign.private.default.layout', function ($view) { $view->with('userdata', \App\User::getAllUserDataBySlug('haseo-xth')); }); }
public function getListByCategory($slug) { $projects = collect(); if ($slug != "tutti") { $currentMC = \App\MacroCategory::getCurrentMacroCategoryBySlug($slug); $_projects = \App\Project::getProjectsByCateogory($currentMC->id); //dump($_projects); } else { $projects = \App\Project::All(); $currentMC = collect(); $currentMC->name = "tutti"; $currentMC->fonticon = "fa-group"; } foreach ($_projects as $project) { $project = \App\Project::getFullProjectData($project->id); $projects->push($project); } return view('cosplaydesign.pages.lista', compact("projects", "currentMC")); }
public static function getFullProjectData($projID) { $myProject = collect(); $currentProject = \App\Project::getPojectById($projID); $owner = \App\Project::getProjectAuthor($currentProject->id); $tags = \App\Project::getProjectTags($currentProject->meta_keys); $gender = \App\Project::getProjectGenders($currentProject->id); //$materials = \App\Project::getProjectMaterials($currentProject->id); $knobColor = \App\Project::percent2Color($currentProject->progress); $steps = \App\Project::getTutorialStepByProjectId($currentProject->id); $serie = \App\Project::getProjectSerie($currentProject->id); $documents = \App\Project::getProjectDocuments($currentProject->id); $media = \App\Project::getProjectMedia($currentProject->id); $currentProject->fullname = $currentProject->name; $currentProject->name = str_limit($currentProject->name, $limit = 35, $end = '...'); $currentProject->knobColor = $knobColor; $currentProject->directory = "/img/cd-" . $currentProject->slug . "-12345678/"; $currentProject->category = \App\MacroCategory::getCurrentMacroCategoryById($currentProject->macro_category_id); $currentProject->serie = $serie; $currentProject->tags = $tags; $currentProject->owner = $owner; $currentProject->gender = $gender; //$currentProject->materials = $materials; $currentProject->steps = $steps; $currentProject->media = $media; $currentProject->documents = $documents; return $currentProject; }
public static function getCurrentMacroCategoryById($catID) { return \App\MacroCategory::where('id', '=', $catID)->first(); }