예제 #1
0
 public function add(Request $request)
 {
     $validator = Validator::make($request->all(), ['postcode' => 'required|integer', 'country' => 'required', 'address' => 'required']);
     if ($validator->fails()) {
         return redirect('/creator')->withInput()->withErrors($validator);
     }
     $id = Auth::user()->id;
     $creator = new Creator();
     $creator->postcode = $request->postcode;
     $creator->country = $request->country;
     $creator->home_address = $request->address;
     $creator->user_id = $id;
     $creator->save();
     DB::update('update users set isCreator = 1 where id = ?', [$id]);
     return redirect('/new');
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = User::all();
     $count = $users->count();
     $projects = Project::all();
     $comments = Comment::all();
     $categories = Category::all();
     $backers = Backer::all();
     $creators = Creator::all();
     $commentLast = Comment::all()->take(4);
     return view('Admin.index', compact('creators', 'count', 'projects', 'comments', 'categories', 'backers', 'commentLast'));
 }
예제 #3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return Creator::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
예제 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Creator::destroy($id);
     Session::flash('message', 'Successfully deleted');
     return redirect(url('creators'));
 }