/**
  * Display the specified snippet.
  *
  * @param \DarkShare\Submissions\Snippets\Snippet $snippet
  * @return string
  */
 public function show(Snippet $snippet)
 {
     die(var_dump("test"));
     if ($snippet->isProtected() && \Hash::check(app()->request->password, $snippet->password)) {
         return $snippet->body . PHP_EOL;
     }
     if (!$snippet->userHasAccess()) {
         return "Not authorized." . PHP_EOL;
     }
     return $snippet->body;
 }
 /**
  * Handle the command.
  *
  * @param  StoreNewSnippetCommand  $command
  * @return void
  */
 public function handle(StoreNewSnippetCommand $command)
 {
     if (empty($command->title)) {
         $command->title = str_limit($command->body, 10);
     }
     $snippet = Snippet::create(['user_id' => $command->user_id, 'title' => $command->title, 'body' => $command->body, 'mode' => $command->mode, 'password' => $command->password]);
     SnippetSlug::create(['snippet_id' => $snippet->id, 'slug' => $snippet]);
     return $snippet;
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     $users = \DarkShare\Users\User::lists('id')->all();
     foreach (range(1, 100) as $index) {
         $snippet = Snippet::create(['user_id' => $faker->boolean() ? $faker->randomElement($users) : null, 'title' => $faker->sentence(), 'body' => $faker->paragraph(), 'mode' => 'markdown', 'password' => $faker->boolean() ? 'secret' : null]);
         SnippetSlug::create(['snippet_id' => $snippet->id, 'slug' => $snippet]);
     }
 }
 /**
  * Remove the specified snippet from storage.
  *
  * @param \DarkShare\Submissions\Snippets\Snippet $snippet
  * @return \DarkShare\Http\Controllers\Response
  * @throws \Exception
  */
 public function destroy(Snippet $snippet)
 {
     $snippet->delete();
     return redirect()->back();
 }