/**
  * Store a newly created resource in storage.
  * POST /group
  *
  * @return Response
  */
 public function store($id)
 {
     //create sub team
     //return Redirect::action('SubController@create',$id)->with( 'notice', 'This action cannot be perform at this moment, please comeback soon.');
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $parent_team = Team::find($id);
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), Team::$rules_group);
     if ($validator->passes()) {
         $team = new Team();
         $team->id = $uuid;
         $team->name = Input::get('name');
         $team->season_id = $parent_team->season_id;
         $team->program_id = $parent_team->program_id;
         $team->description = $parent_team->description;
         $team->early_due = $parent_team->getOriginal('early_due');
         $team->early_due_deadline = $parent_team->early_due_deadline;
         $team->due = $parent_team->getOriginal('due');
         $team->plan_id = $parent_team->plan_id;
         $team->open = $parent_team->open;
         $team->close = $parent_team->close;
         $team->max = Input::get('max');
         $team->status = $parent_team->getOriginal('status');
         $team->parent_id = $parent_team->id;
         $team->club_id = $club->id;
         $team->allow_plan = 1;
         $status = $team->save();
         if ($status) {
             return Redirect::action('TeamController@show', $parent_team->id)->with('messages', 'Group created successfully');
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('SubController@create', $id)->withErrors($validator)->withInput();
 }
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     session_start();
     if (!isset($_SESSION['AUTH']) || $_SESSION['AUTH'] == false) {
         \App::abort(500, 'User not authenticated');
     }
     $post = file_get_contents('php://input');
     $data = json_decode($post, true);
     if ($data['ipAddr'] != null && $data['type'] != null) {
         //creates a new VM in middleware database. Expects ipaddress and type
         $v = new vm();
         $v->id = \Uuid::generate(4);
         $v->ipAddr = $data['ipAddr'];
         $v->type = $data['type'];
         try {
             //emit request to make vm
             $redis = \Redis::connection();
             // Using the Redis extension provided client
             $redis->publish('demeter', json_encode(array('command' => 'init', 'vm' => $v->id->string, 'type' => $v->type, 'netId' => $_SESSION['AUTH_USER'])));
             if ($v->save()) {
                 echo "success";
             } else {
                 \App::abort(500, 'VM could not be created, please contact an Administrator');
             }
         } catch (Exception $e) {
             \App::abort(500, 'VM could not be created, please contact an Administrator');
         }
     } else {
         \App::abort(500, 'VM could not be created, please contact an Administrator');
     }
 }
Example #3
0
 public function postStoreTransaction(Request $request)
 {
     $input = $request->only('idItemPart', 'qty', 'priceBuy');
     try {
         $arrayData = [];
         $itemId = explode(",", $input['idItemPart']);
         $qty = explode(",", $input['qty']);
         $priceBuy = explode(",", $input['priceBuy']);
         $keyTrans = \Uuid::generate();
         for ($i = 0; $i < count($itemId); $i++) {
             /* Update Stok */
             $this->updateStok($itemId[$i], $qty[$i]);
             /* Update Price */
             $this->updatePrice($itemId[$i], $priceBuy[$i]);
             /* Update Price */
             $this->updatePriceSell($itemId[$i], $priceBuy[$i]);
             $insert['item_id'] = $itemId[$i];
             $insert['qty'] = $qty[$i];
             $insert['price_buy'] = $priceBuy[$i];
             $insert['expedition'] = "-";
             $insert['created_at'] = \Carbon\Carbon::now();
             $insert['updated_at'] = \Carbon\Carbon::now();
             $insert['key_transaction'] = $keyTrans;
             array_push($arrayData, $insert);
         }
         $data = $this->transactionBuy->insert($arrayData);
         return $keyTrans;
     } catch (Exception $e) {
         return "0";
     }
 }
Example #4
0
 public function postStore(UsersRequest $request = null, $id = "")
 {
     $input = $request->except('save_continue', 'password_confirmation');
     $result = '';
     if (\Input::hasFile('photo')) {
         $photo = (new \ImageUpload($input))->upload();
     }
     if ($id == "") {
         $input['id'] = \Uuid::generate();
         $input['photo'] = isset($photo) ? $photo : "";
         $input['password'] = bcrypt($input['password']);
         $query = $this->model->create($input);
         $result = $query->id;
     } else {
         if (\Input::hasFile('photo')) {
             $input['photo'] = isset($photo) ? $photo : "";
         }
         if (isset($input['password']) && $input['password'] != "") {
             $input['password'] = bcrypt($input['password']);
         }
         $this->model->find($id)->update($input);
         $result = $id;
     }
     $save_continue = \Input::get('save_continue');
     $redirect = empty($save_continue) ? $this->url : $this->url . '/edit/' . $result;
     return redirect($redirect)->with('message', 'Berhasil tambah data Pengguna!');
 }
 /**
  * Store a newly created resource in storage.
  * POST /plan
  *
  * @return Response
  */
 public function store()
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $validator = Validator::make(Input::all(), Plan::$rules);
     $uuid = Uuid::generate();
     //check if recurrences
     if ($validator->passes()) {
         $amount = Input::get('total') - Input::get('initial');
         $recurring = Input::get('recurring');
         $recurrences = $amount / $recurring;
         $recidual = fmod($amount, $recurring);
         if ($recidual > 0) {
             return Redirect::action('PlanController@create')->withInput()->with('warning', "Please check the recurring amount and initial amount.");
         }
         $plan = new Plan();
         $plan->id = $uuid;
         $plan->name = Input::get('name');
         $plan->total = Input::get('total');
         $plan->initial = Input::get('initial');
         $plan->recurring = Input::get('recurring');
         $plan->recurrences = $recurrences;
         $plan->frequency_id = Input::get('frequency_id');
         $plan->on = Input::get('on');
         $plan->club_id = $club->id;
         $status = $plan->save();
         if ($status) {
             return Redirect::action('PlanController@index')->with('notice', 'Event created successfully');
         }
         return Redirect::action('PlanController@create')->with('warning', $status);
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('PlanController@create')->withErrors($validator)->withInput();
 }
Example #6
0
File: Id.php Project: kreta/kreta
 protected function __construct($id = null)
 {
     if ($id !== null && !is_scalar($id)) {
         throw new InvalidIdException();
     }
     $this->id = null === $id ? Uuid::generate() : $id;
 }
 public function run()
 {
     $participants = DB::table('event_participant')->get();
     foreach ($participants as $participant) {
         $player = Player::find($participant->player_id);
         $user = User::find($participant->user_id);
         $event = Evento::find($participant->event_id);
         $payment = Payment::find($participant->payment_id);
         $uuid = Uuid::generate();
         $new = new Participant();
         $new->id = $uuid;
         $new->firstname = $player->firstname;
         $new->lastname = $player->lastname;
         $new->due = $event->getOriginal('fee');
         $new->early_due = $event->getOriginal('early_fee');
         $new->early_due_deadline = $event->early_deadline;
         $new->method = 'full';
         $new->plan_id = Null;
         $new->player_id = $player->id;
         $new->event_id = $participant->event_id;
         $new->accepted_on = $participant->created_at;
         $new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
         $new->accepted_user = $participant->user_id;
         $new->status = 1;
         $new->created_at = $participant->created_at;
         $new->updated_at = $participant->updated_at;
         $new->save();
         $update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
         $update->participant_id = $uuid;
         $update->save();
     }
 }
Example #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('groups')->insert(['group_id' => '1', 'group_name' => 'Admin']);
     // \DB::statement("SELECT pg_catalog.setval(pg_get_serial_sequence('groups', 'group_id'), "
     //      . "MAX(group_id)) FROM groups");
     DB::table('users')->insert(['id' => Uuid::generate(), 'group_id' => '1', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'name' => 'Admin Sistem Inventory', 'active' => '1', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     Segment::truncate();
     # Seed the table.
     $segments = [['Seg_Name' => 'Age', 'Seg_CreatedOn' => Carbon\Carbon::now(), 'Seg_CreatedBy' => 1, 'Seg_GUID' => (string) Uuid::generate(4)], ['Seg_Name' => 'Location', 'Seg_CreatedOn' => Carbon\Carbon::now(), 'Seg_CreatedBy' => 1, 'Seg_GUID' => (string) Uuid::generate(4)]];
     Segment::insert($segments);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     Company::truncate();
     # Seed the table.
     $company = [['Cpy_Name' => 'Cahaya Bagi Negri (CBN Indonesia)', 'Cpy_Email' => '*****@*****.**', 'Cpy_WebsiteUrl' => 'http://www.jawaban.com', 'Cpy_Address1' => 'Jl. Sriwijaya Kavling 5-7', 'Cpy_Address2' => 'Lippo Cikarang, Cikarang Selatan', 'Cpy_City' => 'Kabupaten Bekasi', 'Cpy_PostCode' => '17550', 'Cpy_Country' => 'Indonesia', 'Cpy_TimeZone' => 'Asia/Jakarta', 'Cpy_CreatedOn' => Carbon\Carbon::now(), 'Cpy_CreatedBy' => 1, 'Cpy_GUID' => (string) Uuid::generate(4)]];
     Company::insert($company);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     MailList::truncate();
     # Seed the table.
     $mailList = [['Mls_Name' => 'Jawaban Mailing List (Monthly)', 'Mls_EmailAddressFrom' => '*****@*****.**', 'Mls_EmailNameFrom' => 'Webmaster Jawaban.com', 'Mls_Reminder' => 'Y', 'Mls_CompanyName' => 'CBN Indonesia', 'Mls_Address1' => 'Jl. Sriwijaya Kavling 5-7', 'Mls_Address2' => 'Lippo Cikarang', 'Mls_City' => 'Kab. Bekasi', 'Mls_Country' => 'Indonesia', 'Mls_Phone' => '0218888888', 'Mls_NotifType' => 'All', 'Mls_CreatedOn' => Carbon\Carbon::now(), 'Mls_CreatedBy' => 1, 'Mls_GUID' => (string) Uuid::generate(4)]];
     MailList::insert($mailList);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     UserRoleDetail::truncate();
     # Seed the table.
     $userRoleDetails = [['Urd_UserID' => 1, 'Urd_RoleID' => 1, 'Urd_CreatedOn' => Carbon\Carbon::now(), 'Urd_CreatedBy' => 1, 'Urd_GUID' => (string) Uuid::generate(4)], ['Urd_UserID' => 2, 'Urd_RoleID' => 2, 'Urd_CreatedOn' => Carbon\Carbon::now(), 'Urd_CreatedBy' => 1, 'Urd_GUID' => (string) Uuid::generate(4)], ['Urd_UserID' => 3, 'Urd_RoleID' => 3, 'Urd_CreatedOn' => Carbon\Carbon::now(), 'Urd_CreatedBy' => 1, 'Urd_GUID' => (string) Uuid::generate(4)]];
     UserRoleDetail::insert($userRoleDetails);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     Subscriber::truncate();
     # Seed the table.
     $subscribers = [['Sbr_ImportFromID' => 4, 'Sbr_EmailAddress' => '*****@*****.**', 'Sbr_FirstName' => 'Maita', 'Sbr_LastName' => 'Elfrida', 'Sbr_Address1' => 'Perumahan Bagasasi Blok F3 No.1', 'Sbr_Address2' => 'Cibarusah', 'Sbr_Address3' => 'Cikarang Selatan', 'Sbr_CreatedOn' => Carbon\Carbon::now(), 'Sbr_CreatedBy' => 1, 'Sbr_GUID' => (string) Uuid::generate(4)]];
     Subscriber::insert($subscribers);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     PermissionRole::truncate();
     # Seed the table.
     $permissionRoles = [['Pmr_PermissionID' => 1, 'Pmr_RoleID' => 1, 'Pmr_CreatedOn' => Carbon\Carbon::now(), 'Pmr_CreatedBy' => 1, 'Pmr_GUID' => (string) Uuid::generate(4)], ['Pmr_PermissionID' => 2, 'Pmr_RoleID' => 3, 'Pmr_CreatedOn' => Carbon\Carbon::now(), 'Pmr_CreatedBy' => 1, 'Pmr_GUID' => (string) Uuid::generate(4)]];
     PermissionRole::insert($permissionRoles);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     UserAccount::truncate();
     # Seed the table.
     $userAccounts = [['Usr_Name' => 'Administrator', 'Usr_Email' => '*****@*****.**', 'Usr_Password' => bcrypt('optilog2014'), 'Usr_CreatedOn' => Carbon\Carbon::now(), 'Usr_CreatedBy' => 1, 'Usr_GUID' => (string) Uuid::generate(4)], ['Usr_Name' => 'Bambang Adrian', 'Usr_Email' => '*****@*****.**', 'Usr_Password' => bcrypt('content2015'), 'Usr_CreatedOn' => Carbon\Carbon::now(), 'Usr_CreatedBy' => 1, 'Usr_GUID' => (string) Uuid::generate(4)], ['Usr_Name' => 'Faber Banjarnahor', 'Usr_Email' => '*****@*****.**', 'Usr_Password' => bcrypt('supervisor2015'), 'Usr_CreatedOn' => Carbon\Carbon::now(), 'Usr_CreatedBy' => 3, 'Usr_GUID' => (string) Uuid::generate(4)]];
     UserAccount::insert($userAccounts);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     SegmentCriteria::truncate();
     # Seed the table.
     $segmentCriterias = [['Sc_Name' => 'Adult', 'Sc_CreatedOn' => Carbon\Carbon::now(), 'Sc_CreatedBy' => 1, 'Sc_GUID' => (string) Uuid::generate(4)], ['Sc_Name' => 'Kids', 'Sc_CreatedOn' => Carbon\Carbon::now(), 'Sc_CreatedBy' => 1, 'Sc_GUID' => (string) Uuid::generate(4)]];
     SegmentCriteria::insert($segmentCriterias);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     CampaignType::truncate();
     # Seed the table.
     $campaignTypes = [['Cgt_Name' => 'Plain Text', 'Cgt_CreatedOn' => Carbon\Carbon::now(), 'Cgt_CreatedBy' => 1, 'Cgt_GUID' => (string) Uuid::generate(4)], ['Cgt_Name' => 'HTML', 'Cgt_CreatedOn' => Carbon\Carbon::now(), 'Cgt_CreatedBy' => 1, 'Cgt_GUID' => (string) Uuid::generate(4)]];
     CampaignType::insert($campaignTypes);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     UserRole::truncate();
     # Seed the table.
     $userRoles = [['Ur_Name' => 'Administrator', 'Ur_Slug' => 'admin', 'Ur_CreatedOn' => Carbon\Carbon::now(), 'Ur_CreatedBy' => 1, 'Ur_GUID' => (string) Uuid::generate(4)], ['Ur_Name' => 'Content Editor', 'Ur_Slug' => 'content-editor', 'Ur_CreatedOn' => Carbon\Carbon::now(), 'Ur_CreatedBy' => 1, 'Ur_GUID' => (string) Uuid::generate(4)], ['Ur_Name' => 'Supervisor', 'Ur_Slug' => 'supervisor', 'Ur_CreatedOn' => Carbon\Carbon::now(), 'Ur_CreatedBy' => 1, 'Ur_GUID' => (string) Uuid::generate(4)], ['Ur_Name' => 'Designer', 'Ur_Slug' => 'designer', 'Ur_CreatedOn' => Carbon\Carbon::now(), 'Ur_CreatedBy' => 1, 'Ur_GUID' => (string) Uuid::generate(4)], ['Ur_Name' => 'Manager', 'Ur_Slug' => 'manager', 'Ur_CreatedOn' => Carbon\Carbon::now(), 'Ur_CreatedBy' => 1, 'Ur_GUID' => (string) Uuid::generate(4)]];
     UserRole::insert($userRoles);
 }
Example #19
0
 /**
  * add UUID to existing request
  * @return Request
  */
 public function prepareRequest()
 {
     // get all input
     $request = Request::all();
     // attach uuid as id
     $request['id'] = Uuid::generate(4)->string;
     return $request;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     ImportFrom::truncate();
     # Seed the table.
     $importFrom = [['Imf_Name' => 'Old Database', 'Imf_Description' => 'Import from old database', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)], ['Imf_Name' => 'Excel', 'Imf_Description' => 'Import from excel', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)], ['Imf_Name' => 'Register', 'Imf_Description' => 'Registered subscriber', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)], ['Imf_Name' => 'Manual Input', 'Imf_Description' => 'Manual input subscriber registration', 'Imf_CreatedOn' => Carbon\Carbon::now(), 'Imf_CreatedBy' => 1, 'Imf_GUID' => (string) Uuid::generate(4)]];
     ImportFrom::insert($importFrom);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     MailTrackingStatus::truncate();
     # Seed the table.
     $mailTrackingStatuses = [['Mts_Name' => 'open', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'read', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'click', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'subscribe', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'unsubscribe', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'bounce', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)], ['Mts_Name' => 'fail', 'Mts_CreatedOn' => Carbon\Carbon::now(), 'Mts_CreatedBy' => 1, 'Mts_GUID' => (string) Uuid::generate(4)]];
     MailTrackingStatus::insert($mailTrackingStatuses);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     # Clear the table.
     Permission::truncate();
     # Seed the table.
     $permissions = [['Pm_Name' => 'Show All', 'Pm_Slug' => 'show-all', 'Pm_Description' => 'Show all menu', 'Pm_CreatedOn' => Carbon\Carbon::now(), 'Pm_CreatedBy' => 1, 'Pm_GUID' => (string) Uuid::generate(4)], ['Pm_Name' => 'Show Campaign', 'Pm_Slug' => 'show-campaign', 'Pm_Description' => 'Only show campaign menu', 'Pm_CreatedOn' => Carbon\Carbon::now(), 'Pm_CreatedBy' => 1, 'Pm_GUID' => (string) Uuid::generate(4)]];
     Permission::insert($permissions);
 }
Example #23
0
 public static function create(array $attributes = array(), $confirmation = true)
 {
     $attributes["confirmation_code"] = \Uuid::generate()->string;
     $user = parent::create($attributes);
     if ($confirmation) {
         self::sendComfirmationMail($user);
     }
     return $user;
 }
Example #24
0
 protected static function boot()
 {
     parent::boot();
     static::saving(function ($model) {
         // If model ID is empty, means new record, if it is not incrementing means UUID type
         if (empty($model->id) && $model->incrementing === false) {
             $model->id = (string) \Uuid::generate(4);
         }
     });
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = \SmartBell\User::create(['email' => '*****@*****.**', 'password' => bcrypt('123')]);
     $bell = \SmartBell\Bell::create(['name' => "Test Klingel", 'user_id' => $user->id, 'active' => 1, 'uuid' => Uuid::generate(1)->string]);
     $bell->name = "Test Klingel";
     $bell->user_id = $user->id;
     $bell->active = true;
     $bell->save();
     for ($i = 0; $i < 10; $i++) {
         \SmartBell\Ring::create(['user_id' => $user->id, 'bell_id' => $bell->id, 'file' => '']);
     }
 }
Example #26
0
 public static function boot()
 {
     parent::boot();
     self::creating(function ($user) {
         $user->user_id = Uuid::generate(4);
     });
     self::saving(function ($user) {
         if (!empty($user->password)) {
             $user->password = Hash::make($user->password);
         }
     });
 }
 /**
 * Store a newly created resource in storage.
 * POST /administratorclub
 *
 * @return Response
 */
 public function store()
 {
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), AdministratorClub::$rules);
     if ($validator->passes()) {
         $repo = App::make('UserRepository');
         $user = $repo->signup(Input::all());
         $role = Role::find(2);
         $user->attachRole($role);
         if ($user->id) {
             $profile = new Profile();
             $profile->user_id = $user->id;
             $profile->firstname = Input::get('firstname');
             $profile->lastname = Input::get('lastname');
             $profile->mobile = Input::get('mobile');
             $profile->avatar = '/img/coach-avatar.jpg';
             $profile->save();
             $club = new Club();
             $club->id = $uuid;
             $club->name = Input::get('name');
             $club->sport = 'lacrosse';
             $club->phone = Input::get('contactphone');
             $club->website = Input::get('website');
             $club->email = Input::get('contactemail');
             $club->add1 = Input::get('add1');
             $club->city = Input::get('city');
             $club->state = Input::get('state');
             $club->zip = Input::get('zip');
             $club->logo = Input::get('logo');
             $club->waiver = Input::get('waiver');
             $club->processor_user = Crypt::encrypt(Input::get('processor_user'));
             $club->processor_pass = Crypt::encrypt(Input::get('processor_pass'));
             $club->save();
             $clubs = Club::find($uuid);
             $clubs->users()->save($user);
             if (Config::get('confide::signup_email')) {
                 Mail::queueOn(Config::get('confide::email_queue'), Config::get('confide::email_account_confirmation'), compact('user'), function ($message) use($user) {
                     $message->to($user->email, $user->username)->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
                 });
             }
             return Redirect::action('UsersController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
         } else {
             $error = $user->errors()->all(':message');
             return Redirect::back()->withInput(Input::except('password'))->withErrors($error);
         }
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
Example #28
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $demo_useruuid = DB::table('users')->where('email', '*****@*****.**')->value('uuid');
     $demo_list1uuid = DB::table('lists')->where('list_name', 'Demo List 1')->value('list_uuid');
     $demo_list2uuid = DB::table('lists')->where('list_name', 'Demo List 2')->value('list_uuid');
     /**/
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list1uuid, 'item_name' => 'Eggs', 'item_description' => 'Unfertalised chicken periods.', 'item_quantity' => 6]);
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list1uuid, 'item_name' => 'Bacon', 'item_description' => 'Pigs shed skin like snakes. That skin becomes bacon.', 'item_quantity' => 1]);
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list1uuid, 'item_name' => 'Loaf Of Toast', 'item_description' => 'A bag of pre-grilled bread.', 'item_quantity' => 1]);
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list1uuid, 'item_name' => 'Toilet Roll', 'item_description' => 'For the dinner dumper.', 'item_quantity' => 4]);
     /**/
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list2uuid, 'item_name' => 'Carrots', 'item_description' => 'Originally purple in colour.', 'item_quantity' => 6]);
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list2uuid, 'item_name' => 'Peas', 'item_description' => 'Down at the bottom of the garden, among the birds and the bees.', 'item_quantity' => 1]);
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list2uuid, 'item_name' => 'Loaf Of Toast', 'item_description' => 'A bag of pre-grilled bread.', 'item_quantity' => 1]);
     DB::table('items')->insert(['item_uuid' => Uuid::generate(4), 'item_listuuid' => $demo_list2uuid, 'item_name' => 'Toilet Roll', 'item_description' => 'For the dinner dumper.', 'item_quantity' => 4]);
 }
 /**
  * @param Request $request
  *
  * @return \Illuminate\Http\JsonResponse
  * @throws \Exception
  */
 public function storeImage(Request $request)
 {
     if (!$request->hasFile('file')) {
         return response()->json(['status' => 0, 'message' => 'No uploaded image.']);
     }
     $image = $request->file('file');
     if (!$image->isValid()) {
         return response()->json(['status' => 2, 'message' => 'Corrupted.']);
     }
     $extension = $image->getClientOriginalExtension();
     $originalName = $image->getClientOriginalName();
     $imageName = sha1(\Uuid::generate(1) . $originalName . \Uuid::generate(5, $originalName, \Uuid::NS_DNS) . \Uuid::generate(4)) . '.' . $extension;
     $link = date('Y') . '-' . date('m');
     $destination = public_path() . '/uploads/' . $link;
     if (!file_exists($destination)) {
         mkdir($destination, 0777, TRUE);
     }
     $image->move($destination, $imageName);
     return response()->json(['status' => 1, 'message' => 'Uploaded OK.', 'name' => $link . '/' . $imageName, 'link' => 'image/' . $link . '/' . $imageName]);
 }
 /**
  * Store a newly created resource in storage.
  * POST /program
  *
  * @return Response
  */
 public function store()
 {
     //get current club
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), Program::$rules);
     if ($validator->passes()) {
         $program = new Program();
         $program->id = $uuid;
         $program->name = Input::get('name');
         $program->club_id = $club->id;
         $program->user_id = $user->id;
         $program->description = Input::get('description');
         $status = $program->save();
         if ($status) {
             return Redirect::action('ProgramController@index')->with('messages', 'Program created successfully');
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('ProgramController@create')->withErrors($validator)->withInput();
 }