/** * Handle the command. * * @param CreateClientCommand $command * @return void */ public function handle(CreateClientCommand $command) { $client = Client::create(['name' => $command->name, 'pay' => $command->pay, 'due' => $command->due]); if (!empty($client)) { return $client; } return false; }
/** * Store a newly created resource in storage. * * @return \Illuminate\Http\Response */ public function store(ClientRequest $request) { // Check authorisation and throw 404 if not if (!$this->authorised('create')) { return view('errors.404'); } $client_request = $request->except('tabs'); // Create Client Client::create($client_request); Toastr::success("Created new client", "Success"); return view('client.list'); }
public function run() { $this->command->info('Running UserTableSeeder'); Eloquent::unguard(); $faker = Faker\Factory::create(); $company = Company::create(); $account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => InvoiceDesign::where('id', '<', CUSTOM_DESIGN)->get()->random()->id, 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]); $user = User::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false, 'is_admin' => 1]); $client = Client::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => DEFAULT_COUNTRY, 'currency_id' => DEFAULT_CURRENCY]); Contact::create(['user_id' => $user->id, 'account_id' => $account->id, 'client_id' => $client->id, 'public_id' => 1, 'email' => env('TEST_EMAIL', TEST_USERNAME), 'is_primary' => true]); Product::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'product_key' => 'ITEM', 'notes' => 'Something nice...', 'cost' => 10]); Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Client $table, Request $request) { $inputs = \Input::except('_token', 'client_logo'); foreach ($inputs as $k => $v) { if (is_array($v)) { $inputs[$k] = json_encode($v); } } $table->validate($request, $table->rules()); $client = $table->create($inputs); if ($request->hasFile('client_logo')) { $table->uploadFile($request->file("client_logo"), $client->id); } $notification[] = array('type' => 'success', 'message' => \Lang::get('notification.store_success')); \Session::flash('notification', $notification); return redirect('client'); }
public function store(CreateClientRequest $request, Client $client) { $client->create($request->all()); return redirect()->route('clients.index'); }
public function create($requestData) { Client::create($requestData); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(ClientStoreRequest $request) { $this->data->client = Client::create($request->all()); return $this->json(); }
public function create($requestData) { $client = Client::create($requestData); Session()->flash('flash_message', 'Client successfully added'); event(new \App\Events\ClientAction($client, self::CREATED)); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('clients')->delete(); $testmodpack = Client::create(array('name' => 'TestClient', 'uuid' => '2ezf6f26-eb15-4ccb-9f0b-8z5ed2c72946')); }
/** * Setup */ public function setup() { echo "<h1>Setup</h1>"; DB::table('z_lookup_company')->truncate(); // Create System, Open Hands + Cape Cod Companies $sys = Company::create(array('name' => 'System', 'email' => '*****@*****.**', 'status' => '1', 'subscription' => '9', 'created_by' => '1', 'updated_by' => '1', 'parent_company' => '0')); $oh = Company::create(array('name' => 'Open Hands', 'email' => '*****@*****.**', 'phone' => '0414 849 091', 'address' => '1438 South Arm Rd', 'suburb' => 'Clifton Beach', 'state' => 'TAS', 'postcode' => '7020', 'status' => '1', 'subscription' => '9', 'created_by' => '1', 'updated_by' => '1', 'parent_company' => '0')); $cc = Company::create(array('name' => 'Cape Cod', 'email' => '*****@*****.**', 'phone' => '(02) 9849 4444', 'address' => '4th Floor, 410 Church St', 'suburb' => 'Parramatta', 'state' => 'NSW', 'postcode' => '2151', 'status' => '1', 'subscription' => '3', 'created_by' => '1', 'updated_by' => '1', 'parent_company' => '0')); zLookupCompany::create(array('old' => '12', 'new' => '3')); echo "Created companies System, Open Hands + Cape Cod<br>"; // Attach Role "Super Admin" // Create User System $system = User::create(array('username' => 'system', 'email' => '*****@*****.**', 'password' => '$2y$10$QejRefLCIU.vXgO.R5x3xOhu5NN7zyAPkofU6DZSrpLvwVrgWfOce', 'firstname' => 'System', 'company_id' => '1', 'status' => '1', 'created_by' => '1', 'updated_by' => '1')); // Create Admin System $admin = User::create(array('username' => 'admin', 'email' => '*****@*****.**', 'password' => '$2y$10$QejRefLCIU.vXgO.R5x3xOhu5NN7zyAPkofU6DZSrpLvwVrgWfOce', 'firstname' => 'Fudge', 'lastname' => 'Jordan', 'phone' => '0414 849 091', 'address' => '1438 South Arm Rd', 'suburb' => 'Clifton Beach', 'state' => 'TAS', 'postcode' => '7020', 'photo' => '', 'company_id' => '2', 'status' => '1', 'created_by' => '1', 'updated_by' => '1')); //$admin = User::find(1); $admin->attachRole(1); // Create User Fudge $fudge = User::create(array('username' => 'fudge', 'email' => '*****@*****.**', 'password' => '$2y$10$QejRefLCIU.vXgO.R5x3xOhu5NN7zyAPkofU6DZSrpLvwVrgWfOce', 'firstname' => 'Fudge', 'lastname' => 'Jordan', 'phone' => '0414 849 091', 'address' => '1438 South Arm Rd', 'suburb' => 'Clifton Beach', 'state' => 'TAS', 'postcode' => '7020', 'photo' => 'filebank/users/2/photo.jpg', 'company_id' => '3', 'status' => '1', 'created_by' => '1', 'updated_by' => '1')); $fudge->attachRole(2); echo "Created users Admin + Fudge<br>"; // Create Default Client $client1 = Client::create(array('name' => 'Unassigned Client', 'phone' => 'phone', 'address' => 'address', 'suburb' => 'suburb', 'state' => 'NSW', 'postcode' => 'postcode', 'company_id' => '3', 'status' => '1', 'created_by' => '1', 'updated_by' => '1')); echo "Created default client<br>"; }