public function run() { $faker = Faker\Factory::create(); User::create(['username' => 'jstoone', 'password' => 'secret']); foreach (range(1, 50) as $index) { User::create(['username' => $faker->userName, 'password' => 'secret']); } }
public function run() { $faker = Faker\Factory::create(); $users = \DarkShare\Users\User::lists('id')->all(); foreach (range(1, 100) as $index) { $file = File::create(['user_id' => $faker->boolean() ? $faker->randomElement($users) : null, 'title' => $faker->sentence(), 'path' => '/home/vagrant/sites/darkshare/storage/app/testfile.md', 'password' => $faker->boolean() ? 'secret' : null]); FileSlug::create(['file_id' => $file->id, 'slug' => $file]); } }
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]); } }
public function run() { $faker = Faker\Factory::create(); $users = User::lists('id')->all(); foreach (range(1, 100) as $index) { $url = Url::create(['user_id' => $faker->boolean() ? $faker->randomElement($users) : null, 'destination' => $faker->url, 'password' => $faker->boolean() ? 'secret' : null]); UrlSlug::create(['url_id' => $url->id, 'slug' => $url]); } }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { parent::boot($router); $router->bind('snippets', function ($value) { return SnippetSlug::where(\DB::raw('BINARY slug'), $value)->firstOrFail()->snippet; }); $router->bind('files', function ($value) { return FileSlug::where(\DB::raw('BINARY slug'), $value)->firstOrFail()->file; }); $router->bind('urls', function ($value) { return UrlSlug::where(\DB::raw('BINARY slug'), $value)->firstOrFail()->url; }); $router->bind('username', function ($value) { return User::where('username', $value)->firstOrFail(); }); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { $user = User::create(['username' => $data['username'], 'password' => $data['password']]); flash()->success("Welcome " . $user->username . "!"); return $user; }
public function run() { $user = User::where('username', 'jstoone')->first(); AdminUser::create(['user_id' => $user->id]); }
/** * Display a listing of a users latest content * * @param $code * @param \DarkShare\Users\User $user * @return \Illuminate\View\View */ public function user($code, User $user) { $user->load(['snippets', 'files', 'urls']); return view('admin.users', compact('user')); }