/**
  * Store a newly created Tag in storage.
  *
  * @param CreateTagRequest $request
  *
  * @return Response
  */
 public function store(CreateTagRequest $request)
 {
     $input = $request->all();
     $tag = Tag::create($input);
     Flash::message('Tag saved successfully.');
     return redirect(route('admin.tags.index'));
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         \App\Models\Tag::create(['name' => $faker->word]);
     }
 }
Exemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 100; $i++) {
         $tag = Tag::create(['name' => $faker->domainWord]);
         $tag->save();
     }
 }
Exemplo n.º 4
0
 public function create()
 {
     $user = $this->auth();
     $data = Input::get();
     $data['userId'] = $user->_id;
     $result = Tag::create($data);
     return $this->output($result->_id);
 }
Exemplo n.º 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tags')->truncate();
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 30; $i++) {
         Tag::create(['name' => $faker->unique()->word]);
     }
 }
Exemplo n.º 6
0
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        $lipsum = new LoremIpsumGenerator();
        Role::create(['title' => 'Administrator', 'slug' => 'admin']);
        Role::create(['title' => 'Redactor', 'slug' => 'redac']);
        Role::create(['title' => 'User', 'slug' => 'user']);
        User::create(['username' => 'GreatAdmin', 'email' => '*****@*****.**', 'password' => bcrypt('admin'), 'seen' => true, 'role_id' => 1, 'confirmed' => true]);
        User::create(['username' => 'GreatRedactor', 'email' => '*****@*****.**', 'password' => bcrypt('redac'), 'seen' => true, 'role_id' => 2, 'valid' => true, 'confirmed' => true]);
        User::create(['username' => 'Walker', 'email' => '*****@*****.**', 'password' => bcrypt('walker'), 'role_id' => 3, 'confirmed' => true]);
        User::create(['username' => 'Slacker', 'email' => '*****@*****.**', 'password' => bcrypt('slacker'), 'role_id' => 3, 'confirmed' => true]);
        Contact::create(['name' => 'Dupont', 'email' => '*****@*****.**', 'text' => 'Lorem ipsum inceptos malesuada leo fusce tortor sociosqu semper, facilisis semper class tempus faucibus tristique duis eros, cubilia quisque habitasse aliquam fringilla orci non. Vel laoreet dolor enim justo facilisis neque accumsan, in ad venenatis hac per dictumst nulla ligula, donec mollis massa porttitor ullamcorper risus. Eu platea fringilla, habitasse.']);
        Contact::create(['name' => 'Durand', 'email' => '*****@*****.**', 'text' => ' Lorem ipsum erat non elit ultrices placerat, netus metus feugiat non conubia fusce porttitor, sociosqu diam commodo metus in. Himenaeos vitae aptent consequat luctus purus eleifend enim, sollicitudin eleifend porta malesuada ac class conubia, condimentum mauris facilisis conubia quis scelerisque. Lacinia tempus nullam felis fusce ac potenti netus ornare semper molestie, iaculis fermentum ornare curabitur tincidunt imperdiet scelerisque imperdiet euismod.']);
        Contact::create(['name' => 'Martin', 'email' => '*****@*****.**', 'text' => 'Lorem ipsum tempor netus aenean ligula habitant vehicula tempor ultrices, placerat sociosqu ultrices consectetur ullamcorper tincidunt quisque tellus, ante nostra euismod nec suspendisse sem curabitur elit. Malesuada lacus viverra sagittis sit ornare orci, augue nullam adipiscing pulvinar libero aliquam vestibulum, platea cursus pellentesque leo dui. Lectus curabitur euismod ad, erat.', 'seen' => true]);
        Tag::create(['tag' => 'Tag1']);
        Tag::create(['tag' => 'Tag2']);
        Tag::create(['tag' => 'Tag3']);
        Tag::create(['tag' => 'Tag4']);
        Post::create(['title' => 'Post 1', 'slug' => 'post-1', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/mega-champignon.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => $lipsum->getContent(500), 'active' => true, 'user_id' => 1]);
        Post::create(['title' => 'Post 2', 'slug' => 'post-2', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/goomba.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => '<p>Lorem ipsum convallis ac curae non elit ultrices placerat netus metus feugiat, non conubia fusce porttitor sociosqu diam commodo metus in himenaeos, vitae aptent consequat luctus purus eleifend enim sollicitudin eleifend porta. Malesuada ac class conubia condimentum mauris facilisis conubia quis scelerisque lacinia, tempus nullam felis fusce ac potenti netus ornare semper. Molestie iaculis fermentum ornare curabitur tincidunt imperdiet scelerisque, imperdiet euismod scelerisque torquent curae rhoncus, sollicitudin tortor placerat aptent hac nec. Posuere suscipit sed tortor neque urna hendrerit vehicula duis litora tristique congue nec auctor felis libero, ornare habitasse nec elit felis inceptos tellus inceptos cubilia quis mattis faucibus sem non.</p>

<p>Odio fringilla class aliquam metus ipsum lorem luctus pharetra dictum, vehicula tempus in venenatis gravida ut gravida proin orci, quis sed platea mi quisque hendrerit semper hendrerit. Facilisis ante sapien faucibus ligula commodo vestibulum rutrum pretium, varius sem aliquet himenaeos dolor cursus nunc habitasse, aliquam ut curabitur ipsum luctus ut rutrum. Odio condimentum donec suscipit molestie est etiam sit rutrum dui nostra, sem aliquet conubia nullam sollicitudin rhoncus venenatis vivamus rhoncus netus, risus tortor non mauris turpis eget integer nibh dolor. Commodo venenatis ut molestie semper adipiscing amet cras, class donec sapien malesuada auctor sapien arcu inceptos, aenean consequat metus litora mattis vivamus.</p>

<pre>
<code class="language-php">protected function getUserByRecaller($recaller)
{
	if ($this-&gt;validRecaller($recaller) &amp;&amp; ! $this-&gt;tokenRetrievalAttempted)
	{
		$this-&gt;tokenRetrievalAttempted = true;

		list($id, $token) = explode("|", $recaller, 2);

		$this-&gt;viaRemember = ! is_null($user = $this-&gt;provider-&gt;retrieveByToken($id, $token));

		return $user;
	}
}</code></pre>

<p>Feugiat arcu adipiscing mauris primis ante ullamcorper ad nisi, lobortis arcu per orci malesuada blandit metus tortor, urna turpis consectetur porttitor egestas sed eleifend. Eget tincidunt pharetra varius tincidunt morbi malesuada elementum mi torquent mollis, eu lobortis curae purus amet vivamus amet nulla torquent, nibh eu diam aliquam pretium donec aliquam tempus lacus. Tempus feugiat lectus cras non velit mollis sit et integer, egestas habitant auctor integer sem at nam massa himenaeos, netus vel dapibus nibh malesuada leo fusce tortor. Sociosqu semper facilisis semper class tempus faucibus tristique duis eros, cubilia quisque habitasse aliquam fringilla orci non vel, laoreet dolor enim justo facilisis neque accumsan in.</p>

<p>Ad venenatis hac per dictumst nulla ligula donec, mollis massa porttitor ullamcorper risus eu platea, fringilla habitasse suscipit pellentesque donec est. Habitant vehicula tempor ultrices placerat sociosqu ultrices consectetur ullamcorper tincidunt quisque tellus, ante nostra euismod nec suspendisse sem curabitur elit malesuada lacus. Viverra sagittis sit ornare orci augue nullam adipiscing pulvinar libero aliquam vestibulum platea cursus pellentesque leo dui lectus, curabitur euismod ad erat curae non elit ultrices placerat netus metus feugiat non conubia fusce porttitor. Sociosqu diam commodo metus in himenaeos vitae aptent consequat luctus purus eleifend enim sollicitudin eleifend, porta malesuada ac class conubia condimentum mauris facilisis conubia quis scelerisque lacinia.</p>

<p>Tempus nullam felis fusce ac potenti netus ornare semper molestie iaculis, fermentum ornare curabitur tincidunt imperdiet scelerisque imperdiet euismod. Scelerisque torquent curae rhoncus sollicitudin tortor placerat aptent hac, nec posuere suscipit sed tortor neque urna hendrerit, vehicula duis litora tristique congue nec auctor. Felis libero ornare habitasse nec elit felis, inceptos tellus inceptos cubilia quis mattis, faucibus sem non odio fringilla. Class aliquam metus ipsum lorem luctus pharetra dictum vehicula, tempus in venenatis gravida ut gravida proin orci, quis sed platea mi quisque hendrerit semper.</p>
', 'active' => true, 'user_id' => 2]);
        Post::create(['title' => 'Post 3', 'slug' => 'post-3', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/rouge-shell.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => $lipsum->getContent(500), 'active' => true, 'user_id' => 2]);
        Post::create(['title' => 'Post 4', 'slug' => 'post-4', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/rouge-shyguy.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => $lipsum->getContent(500), 'active' => true, 'user_id' => 2]);
        PostTag::create(['post_id' => 1, 'tag_id' => 1]);
        PostTag::create(['post_id' => 1, 'tag_id' => 2]);
        PostTag::create(['post_id' => 2, 'tag_id' => 1]);
        PostTag::create(['post_id' => 2, 'tag_id' => 2]);
        PostTag::create(['post_id' => 2, 'tag_id' => 3]);
        PostTag::create(['post_id' => 3, 'tag_id' => 1]);
        PostTag::create(['post_id' => 3, 'tag_id' => 2]);
        PostTag::create(['post_id' => 3, 'tag_id' => 4]);
        Comment::create(['content' => $lipsum->getContent(200), 'user_id' => 2, 'post_id' => 1]);
        Comment::create(['content' => $lipsum->getContent(200), 'user_id' => 2, 'post_id' => 2]);
        Comment::create(['content' => $lipsum->getContent(200), 'user_id' => 3, 'post_id' => 1]);
    }
Exemplo n.º 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $colors = ['#B3B5B4', '#25AAE2', '#AB9364', '#92278F', '#0E76BD', '#F7941D', '#3AB54A', '#808281'];
     foreach (range(0, 30) as $index) {
         $name = $faker->word;
         Tag::create(['name' => $name, 'slug' => $name, 'description' => $faker->sentence, 'topic_count' => 0, 'color' => $faker->randomElement($colors)]);
     }
 }
Exemplo n.º 8
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @param URI int $fact_id
  * @return Response
  */
 public function store(Request $request)
 {
     if (!$request->input('tag_name')) {
         return $this->respondUnprocessed();
     }
     $tag_name = $request->input('tag_name');
     Tag::create(['tag_name' => $tag_name]);
     return $this->respondCreated();
 }
Exemplo n.º 9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $this->beforeRun();
     DB::table('Tag')->truncate();
     $csv = new \mnshankar\CSV\CSV();
     $tags = $csv->fromFile(dirname(__FILE__) . '/csv/Tag.csv')->toArray();
     foreach ($tags as $t) {
         \App\Models\Tag::create($t);
     }
     $this->afterRun();
 }
Exemplo n.º 10
0
 protected function savePostTags($postID, $tags)
 {
     foreach ($tags as $tag) {
         $resultTag = Tag::where(\DB::Raw('BINARY name'), $tag);
         if ($resultTag->count()) {
             $tagID = $resultTag->first()->id;
         } else {
             $resultTag = Tag::create(array('name' => $tag));
             $tagID = $resultTag->id;
         }
         PostTag::create(array('post_id' => $postID, 'tag_id' => $tagID));
     }
 }
Exemplo n.º 11
0
 public function saveTags(Product $product, array $tags)
 {
     $results = [];
     foreach ($tags as $tag) {
         $tag = trim($tag);
         $find = Tag::where('name', $tag)->first();
         if (!$find) {
             $find = Tag::create(['name' => $tag]);
         }
         $results[] = $find;
     }
     $product_ids = collect($results)->pluck('id');
     $product->tags()->attach($product_ids->toArray());
     return $results;
 }
Exemplo n.º 12
0
 public function store()
 {
     $tags = \Input::get('tags');
     if ($tags && count($tags)) {
         $results = array();
         foreach ($tags as $tag) {
             $resultTag = Tag::where(\DB::Raw('BINARY name'), $tag);
             if (!$resultTag->count()) {
                 $resultTag = Tag::create(array('name' => $tag));
                 array_push($results, array($tag => $resultTag));
             } else {
                 array_push($results, array($tag => 'Exsiting'));
             }
         }
         Cache::forget('all_tag');
         return self::makeResponse($results, 201);
     } else {
         return self::makeResponse(array(), 400, 'Bad Request');
     }
 }
Exemplo n.º 13
0
 /**
  * Responds to requests to POST /article/create
  *
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function postCreate(Request $request)
 {
     $input = $request->all();
     $input['user_id'] = Auth::id();
     $input['tags'] = array_map('trim', explode(',', $input['tags']));
     $input['task_id'] = $input['task_id'] ? $input['task_id'] : null;
     if ($input['action'] == "Odoslať") {
         $input['state'] = Article::PUBLISHED;
     } else {
         $input['state'] = Article::DRAFT;
     }
     if ($article = Article::findBySlugOrId($input['id'])) {
         $article->update($input);
         $article->resluggify()->save();
     } else {
         $article = Article::create($input);
     }
     ArticleTagMapper::where('article_id', '=', $article->id)->delete();
     foreach ($input['tags'] as $tagName) {
         if ($tagName) {
             if (!($tag = Tag::where('name', '=', $tagName)->first())) {
                 $tag = Tag::create(['name' => $tagName]);
             }
             ArticleTagMapper::create(['article_id' => $article->id, 'tag_id' => $tag->id]);
         }
     }
     if ($request->ajax()) {
         $count = Auth::user()->articles()->draft()->count();
         return response()->json(['id' => $article->id, 'status' => 'success', 'count' => $count]);
     } else {
         if ($input['action'] == "Odoslať") {
             flash()->success('Článok bol publikovaný');
             return redirect()->action('UserController@getProfile', ['id' => Auth::user()->slug]);
         } else {
             flash()->success('Článok bol uložený');
             return redirect(URL::action('ArticleController@getDraft', ['id' => $article->slug]));
         }
     }
 }
Exemplo n.º 14
0
 /**
  * @param $user
  */
 public function tagMockFacts($user)
 {
     // create two tags
     $tag_id = Tag::create(['tag_name' => 'Test Tag1'])->id;
     $tag_id2 = Tag::create(['tag_name' => 'Test Tag2'])->id;
     $facts = Fact::where('user_id', $user->id)->get();
     foreach ($facts as $fact) {
         // Basically a 50/50 coin flip whether a tag is going to get tag 1 or tag 2
         rand(0, 1) ? \App\Models\TaggedFact::create(['fact_id' => $fact->id, 'tag_id' => $tag_id]) : \App\Models\TaggedFact::create(['fact_id' => $fact->id, 'tag_id' => $tag_id2]);
     }
 }
Exemplo n.º 15
0
 public function seedTags($type, array $names)
 {
     foreach ($names as $i => $name) {
         Tag::create(['type' => $type, 'name' => faker()->translate($name), 'draft' => 0, 'online' => 1, 'order_column' => $i]);
     }
 }
Exemplo n.º 16
0
 public function create(array $data)
 {
     return Tag::create($data);
 }
Exemplo n.º 17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TagsRequest $request)
 {
     $tag = Tag::create($request->all())->save();
     return redirect()->route('tags.index');
 }
Exemplo n.º 18
0
 public function run()
 {
     for ($i = 1; $i <= 50; $i++) {
         Tag::create(['name' => 'Tag' . $i, 'hot' => rand(0, 300)]);
     }
 }
Exemplo n.º 19
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Tag::create(["name" => "test"]);
     Tag::create(["name" => "work"]);
     Tag::create(["name" => "study"]);
 }
Exemplo n.º 20
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     Tag::create($request->all());
     return redirect()->route("dashboard.tags.index");
 }
Exemplo n.º 21
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  TagRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(TagRequest $request)
 {
     Tag::create($request->all());
     flash()->success('Tag has been created!');
     return redirect('admin\\tag');
 }
Exemplo n.º 22
0
 protected function make() : Tag
 {
     return Tag::create();
 }
Exemplo n.º 23
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TagsRequest $request)
 {
     $tag = Tag::create($request->all());
     return Redirect::route('special.index');
 }