/**
  * Compose the sidebar.
  */
 private function composeSidebar()
 {
     view()->composer('partials.sidebar', function ($view) {
         $view->with('latest', Article::published()->orderBy('id', 'desc')->take(5)->get());
         $view->with('tags', Tag::all());
     });
 }
 /**
  * Generate or regenerate popular Discover Cache items
  *
  * @param SearchHandlerInterface $searchHandler
  * @param CacheHandlerInterface $cacheHandler
  */
 public function generatePopular(SearchHandlerInterface $searchHandler, CacheHandlerInterface $cacheHandler)
 {
     $tags = Tag::all()->groupBy('name')->orderBy('created_at')->take(20)->get();
     foreach ($tags as $tag) {
         $this->generate($tag, $cacheHandler, $searchHandler);
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('tags', function (Blueprint $table) {
         $table->string('slug')->nullable();
     });
     //Trigger save on each tag to generate slug
     foreach (\App\Models\Tag::all() as $tag) {
         $tag->save();
     }
 }
Example #4
0
 public function getTag()
 {
     $tags = Tag::all();
     return Datatables::of($tags)->edit_column('status', function ($row) {
         return showSelectStatus($row->id, $row->status, 'Kacana.product.tag.setStatusTag(' . $row->id . ', 1)', 'Kacana.product.tag.setStatusTag(' . $row->id . ', 0)');
     })->edit_column('created', function ($row) {
         return showDate($row->created);
     })->edit_column('updated', function ($row) {
         return showDate($row->updated);
     })->add_column('action', function ($row) {
         return showActionButton('Kacana.product.tag.showEditTagForm(' . $row->id . ')', 'Kacana.product.tag.removeTag(' . $row->id . ')', true);
     })->make(true);
 }
Example #5
0
 public function addTags($tags = [])
 {
     $rowTagsName = Tag::all(['name'])->toArray();
     $rowTagsName = array_flatten($rowTagsName);
     foreach ($tags as $key => $tag) {
         if (in_array($tag, $rowTagsName)) {
         } else {
             $tag = new Tag();
             $tag->name = $tag;
             $tag->save();
         }
     }
 }
Example #6
0
 /**
  * Checks that skills/stars/flags are correct
  *
  * (Have to decide an ordering here - probably alphabetical on skill name, case-insensitive)
  */
 public function testProfileNonEmptySkillsMatrix()
 {
     $faker = Faker\Factory::create();
     factory(App\Models\Profile::class, 'withAUser', 1)->create();
     factory(App\Models\Tag::class, 3)->create();
     $profile = App\Models\Profile::first();
     $rating = 5;
     foreach (App\Models\Tag::all() as $tag) {
         $seeking = $faker->boolean;
         $offering = $faker->boolean;
         $profile->add_tag($tag, $rating, $seeking, $offering);
         $tags[] = [$tag->name, $rating, $seeking, $offering];
         $rating = $rating - 1;
     }
     $this->visit(route('profile.view', ['name' => $profile->user->username]))->see('seeInElement', '.rating:nth-child(1)', 6)->see('seeInElement', '.rating:nth-child(2)', 4)->see('seeInElement', '.rating:nth-child(3)', 2);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $tags = Tag::all();
     $skills = Skill::all();
     for ($i = 0; $i < 50; $i++) {
         $user = User::register($faker->unique()->userName, $faker->unique()->email, bcrypt('password'), 'talent');
         $this->userRepository->save($user);
         $profileData = ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'location' => $faker->city, 'describe' => $faker->numberBetween(1, count($skills) - 1), 'about' => $faker->sentence(), 'facebook' => $faker->userName, 'linked_in' => $faker->userName, 'twitter' => $faker->userName, 'meetup' => $faker->userName, 'published' => $faker->boolean()];
         $userSkills = '';
         foreach (range(1, rand(2, 4)) as $x) {
             $id = rand(1, count($tags) - 1);
             $userSkills .= $tags[$id]->name . ",";
         }
         $profileData['skills'] = $userSkills;
         $this->dispatcher->dispatch(new UpdateProfile($user, $profileData));
     }
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $author = User::whereHas('role', function ($q) {
         $q->where('slug', 'admin');
     })->first();
     $categories = Category::where('is_active', 1)->get();
     $postsRecents = Post::where('is_active', 1)->where('seen', 1)->orderBy('created_at', 'desc')->take(3)->get();
     $postsPopular = Post::where('is_active', 1)->where('seen', 1)->orderBy('nview', 'desc')->take(3)->get();
     $commentsRecents = Comment::where('seen', 1)->orderBy('created_at', 'desc')->take(3)->get();
     $tags = Tag::all();
     $INFO_SITE = Admin::first();
     view()->share('author', $author);
     view()->share('categories', $categories);
     view()->share('tags', $tags);
     view()->share('postsRecents', $postsRecents);
     view()->share('postsPopular', $postsPopular);
     view()->share('commentsRecents', $commentsRecents);
     view()->share('INFO_SITE', $INFO_SITE);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $slugify = Slugify::create();
     $users = User::all();
     $tags = Tag::all();
     $skills = Skill::all();
     foreach ($users as $user) {
         foreach (range(1, rand(2, 3)) as $i) {
             $name = $faker->name;
             $startup = Startup::create(['name' => $name, 'description' => $faker->text, 'url' => $slugify->slugify($name), 'user_id' => $user->id, 'published' => true]);
             $this->repository->save($startup);
             $startupTags = [];
             foreach (range(1, rand(2, 4)) as $i) {
                 $id = rand(1, count($tags) - 1);
                 $startupTags[] = $id;
             }
             $needs = [];
             $commitments = ['full-time', 'part-time'];
             foreach (range(1, rand(2, 3)) as $i) {
                 $roleId = rand(1, count($skills) - 1);
                 $needTags = [];
                 foreach (range(1, rand(2, 3)) as $i) {
                     $id = rand(1, count($tags) - 1);
                     $needTags[] = $id;
                 }
                 $needs[] = array('role' => $roleId, 'quantity' => rand(1, 10), 'skills' => implode(',', $needTags), 'commitment' => $commitments[rand(0, 1)], 'desc' => $faker->text);
                 $this->repository->updateNeeds($startup, $needs);
             }
             $startup->tags()->attach($startupTags);
             foreach (range(1, rand(2, 3)) as $i) {
                 $id = rand(1, count($users) - 1);
                 if ($startup->owner->id !== $id) {
                     $this->repository->addMemberRequest($users[$id], $startup, false);
                     if (rand(0, 1)) {
                         $this->repository->approveMemberRequest($users[$id], $startup, false);
                     }
                 }
             }
         }
     }
 }
Example #10
0
 function galeria()
 {
     $posts = \App\Models\Post::all();
     $tags = \App\Models\Tag::all();
     $tagsUsados = [];
     $tagsTotal = [];
     $contTags = 0;
     $contTagsTotal = 0;
     foreach ($posts as $p) {
         foreach ($p->tags as $t) {
             $tagsUsados[$contTags] = $t->clave;
             $contTags++;
         }
     }
     foreach ($tags as $tag) {
         $tagsTotal[$contTagsTotal] = $tag->clave;
         $contTagsTotal++;
     }
     $tagsUsadosNeto = array_intersect($tagsTotal, $tagsUsados);
     return view('front.galeria')->with(array('posts' => $posts, 'tags' => $tags, 'tt' => $tagsUsadosNeto));
 }
Example #11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $tags = Tag::all();
     return view('admin.tag.index')->withTags($tags);
 }
Example #12
0
 /**
  * @param $factId
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getTags($factId)
 {
     if (!is_null($factId)) {
         $fact = Fact::find($factId);
         $fact ? $tags = $fact->tags : ($tags = null);
         return $tags;
     }
     $tags = Tag::all();
     return $tags;
 }
 public function all()
 {
     return Tag::all();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tags = Tag::all();
     return view('admin.tags.index')->with('tags', $tags);
 }
Example #15
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $posts = Post::latest()->get();
     $tags = Tag::all();
     return view('blog.posts', ['posts' => $posts, 'tags' => $tags]);
 }
Example #16
0
 /**
  * @return Collection
  */
 public function getAll()
 {
     // TODO: Implement getAll() method.
     return Tag::all();
 }
Example #17
0
 public function getAll()
 {
     $tags = Tag::all();
     return $tags;
 }
Example #18
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['tags'] = Tag::all();
     return view('tags.index', $data);
 }
Example #19
0
 public function index()
 {
     $tag = Tag::all();
     return $tag;
 }
Example #20
0
 public function showEdit($orderid)
 {
     $tags = Tag::all();
     $status = Orders::status();
     $data = Orders::findOrFail($orderid);
     $tag = new Tag();
     $orderTag = $tag->orderTag($orderid);
     return view('orders.edit', ['orderid' => $orderid, 'tags' => $tags, 'data' => $data, 'status' => $status, 'orderTag' => $orderTag]);
 }
 /**
  * @param $lessonId
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getTags($lessonId)
 {
     $tags = $lessonId ? Lesson::find($lessonId)->tags : Tag::all();
     return $tags;
 }
Example #22
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param Article $article
  * @return \Illuminate\Http\Response
  */
 public function edit($article)
 {
     $tags = Tag::all();
     $dest = Destination::all(['des_id', 'des_name', 'coordinate']);
     return View::make('pages.blogpost', ['model' => $article, 'action' => array('blog.update', $article->article_id), 'method' => 'PUT', 'tags' => $tags->toJson(), 'dest' => $dest->toJson()]);
 }
Example #23
0
 /**
  * Return all Tags from the DB
  *
  * @param null|User $user
  * @return mixed
  */
 public function all($user = null)
 {
     if ($user) {
         return Tag::where('user_id', $user->id)->get();
     }
     return Tag::all();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tags = Tag::all();
     return View('tags-list', ['tags' => $tags]);
 }
 public function index()
 {
     $tags = Tag::all();
     return view('tag.index', compact('tags'));
 }
Example #26
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $question = Question::findOrFail($id);
     $tags = Tag::all();
     return view('questions.edit')->with(['question' => $question, 'tags' => $tags]);
 }