本文整理汇总了PHP中app\models\Client::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::create方法的具体用法?PHP Client::create怎么用?PHP Client::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Client
的用法示例。
在下文中一共展示了Client::create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* 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;
}
示例2: store
/**
* 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');
}
示例3: run
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]);
}
示例4: store
/**
* 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');
}
示例5: store
public function store(CreateClientRequest $request, Client $client)
{
$client->create($request->all());
return redirect()->route('clients.index');
}
示例6: create
public function create($requestData)
{
Client::create($requestData);
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(ClientStoreRequest $request)
{
$this->data->client = Client::create($request->all());
return $this->json();
}
示例8: create
public function create($requestData)
{
$client = Client::create($requestData);
Session()->flash('flash_message', 'Client successfully added');
event(new \App\Events\ClientAction($client, self::CREATED));
}
示例9: run
/**
* 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'));
}
示例10: setup
/**
* 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' => 'system@openhands.com.au', 'status' => '1', 'subscription' => '9', 'created_by' => '1', 'updated_by' => '1', 'parent_company' => '0'));
$oh = Company::create(array('name' => 'Open Hands', 'email' => 'fudge@openhands.com.au', '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' => 'office@capecod.com.au', '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' => 'system@openhands.com.au', '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' => 'fudge@openhands.com.au', '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' => 'fudge@jordan.net.au', '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>";
}