/** * Run the database seeds. * * @return void */ public function run() { $user = \Syndicate\User::firstOrCreate(['email' => '*****@*****.**']); $user->name = 'Jill'; $user->email = '*****@*****.**'; $user->password = \Hash::make('helloworld'); $user->save(); $user = \Syndicate\User::firstOrCreate(['email' => '*****@*****.**']); $user->name = 'Jamal'; $user->email = '*****@*****.**'; $user->password = \Hash::make('helloworld'); $user->save(); }
public function getUserRating($id) { $ratee = \Syndicate\User::find($id)->name; $allRatings = \Syndicate\Rating::orderBy('id', 'DESC')->get(); $starAvg = 0; $starCount = 0; $thisUser = []; foreach ($allRatings as $rating) { if ($rating->ratee_id == $id) { ++$starCount; $starAvg += $rating->star; $thisUser[$starCount] = $rating; } } $starAvg = $starAvg / $starCount; return view('ratings.view')->with('starAvg', $starAvg)->with('starCount', $starCount)->with('ratings', $thisUser)->with('user', $ratee); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }