コード例 #1
0
ファイル: CreatorController.php プロジェクト: Elbar/InvestMe
 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
ファイル: AdminController.php プロジェクト: Elbar/InvestMe
 /**
  * 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'));
 }