public function putCreate(ClientFormRequest $request) { $client = new \App\Client(); $client->put($request->all()); \Flash::success('Client saved.'); return redirect('clients'); }
public function testDeleteClientOk() { $user = App\User::all()->last(); $client = App\Client::count(); $this->actingAs($user)->call('delete', '/client/' . App\Client::all()->last()->Id); $this->assertNotEquals($client - 1, App\Client::count()); }
public function patchUpdate(TicketFormRequest $request, $ticketId) { $ticket = \App\Ticket::find($ticketId); $ticket->patch($request->all()); if (!$ticket) { \Flash::error('Ticket not found'); return redirect('tickets'); } $newClient = trim($request->client_new); if (!empty($newClient)) { $client = new \App\Client(); $client->put(['name' => $newClient]); $ticket->patch(['client_id' => $client->id]); } \Flash::success('Ticket saved.'); return redirect('tickets'); }
public function run() { App\Project::truncate(); App\Client::truncate(); App\Backlog::truncate(); factory(App\Project::class, 20)->create(); factory(App\Client::class, 10)->create(); factory(App\Backlog::class, 100)->create(); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = \Faker\Factory::create(); //User $userEmail = '*****@*****.**'; $user = \App\User::where('email', $userEmail)->first(); if (!$user) { $user = new \App\User(); $user->email = $userEmail; $user->save(); } //Clients $clients = []; $client_ids = []; for ($i = 0; $i < 10; $i++) { $client = new \App\Client(); $client->name = $faker->company; $client->save(); $client_ids[] = $client->id; } //Tickets for ($i = 0; $i < 50; $i++) { $ticket = new \App\Ticket(); $ticket->user_id = $user->id; $ticket->client_id = $client_ids[array_rand($client_ids)]; $ticket->status_id = \App\Status::orderByRaw('RAND()')->first()->id; $ticket->priority = rand(1, 10); $ticket->title = $faker->sentence; $ticket->description = $faker->paragraph; $ticket->save(); } $statuses = [['name' => 'New', 'weight' => '0'], ['name' => 'Pending', 'weight' => '10'], ['name' => 'Resolved', 'weight' => '20', 'billable' => true], ['name' => 'Archived', 'weight' => '30', 'billable' => true, 'archivable' => true]]; foreach ($statuses as $statusData) { $status = \App\Status::where('name', $statusData['name'])->first(); if (!$status) { $status = new \App\Status(); $status->put($statusData); } } }
/** * Run the database seeds. * * @return void */ public function run() { /** * Just a shortcut for creating occurrences. * * When a service is created we want to trigger a event * `ServiceWasCreated` which then creates an occurrence * for that service. */ App\Service::created(function ($service) { event(new App\Events\ServiceWasCreated($service)); }); $categories = ['Hosting', 'Maintenance', 'Domain', 'SSL Certificate']; array_map(function ($category) { return factory(App\Category::class)->create(['name' => $category]); }, $categories); $clients = factory(App\Client::class, 10)->create(); foreach ($clients as $client) { $services = factory(App\Service::class, 10)->create(['client_id' => $client->id, 'category_id' => rand(1, count($categories))]); } /** * Sample User for testing purposes: * * email: sample.user@email.com * password: password * */ factory(App\User::class)->create(['name' => 'Sample User', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'preferred_currency' => 'usd']); /** * Cleanup * * Because there is a long standing bug in Laravel * with model factories, I need to manually remove extra * records created. */ App\Category::has('services', '=', 0)->delete(); App\Client::has('services', '=', 0)->delete(); }
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button> </div> </div> </a> </td> <td class="tariffs_clients_link {{ count($tariff->relations)>0 ? 'client_show_active' : 'client_show_deactive'}} " > <i class="fa fa-users table_icons" data-toggle="tooltip" title="{{ count($tariff->relations)>0 ? 'Клиенты' : 'Нет клиентов'}}"></i> <div class="modal-content tariffs_clients"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Клиенты с тарифом "{{$tariff->name}}"</h4> </div> <div class="modal-body"> <?php $clients = App\Client::whereHas('relations', function ($query) use($tariff) { $query->where('tariff_id', '=', $tariff->id); })->get(); ?> @forelse($clients as $client) {{ $client->name }} <a href="/client/{{ $client->id }}/edit"><i class="table_icons fa fa-pencil" data-toggle="tooltip" title="Редактировать клиента"></i></a><br> @empty @endforelse </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button> </div> </div> </td> <td><a class="comissions_edit" href="/tariff/{{ $tariff->id }}"><i class="table_icons fa fa-money" data-toggle="tooltip" title="Редактирование комиссий"></i></a></td> @if ( $tariff->active == true)
public function run() { $client = new App\Client(); $client->fname = "James"; $client->lname = "Bush"; $client->email = "*****@*****.**"; $client->dob = "6/17/1989"; $client->gender = "Male"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "123-123-1234"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Cristiano"; $client->lname = "Ronaldo"; $client->email = "*****@*****.**"; $client->dob = "2/5/1985"; $client->gender = "Male"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "456-123-1523"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Angelina"; $client->lname = "Jolie"; $client->email = "*****@*****.**"; $client->dob = "6/4/1975"; $client->gender = "Female"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "542-234-1523"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Scarllet"; $client->lname = "Johansson"; $client->email = "*****@*****.**"; $client->dob = "11/22/1984"; $client->gender = "Female"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "123-123-1234"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Ludwig"; $client->lname = "Beethoven"; $client->email = "*****@*****.**"; $client->dob = "3/26/1827"; $client->gender = "Male"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "123-123-1235"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Wolfgang"; $client->lname = "Mozart"; $client->email = "*****@*****.**"; $client->dob = "1/27/1756"; $client->gender = "Male"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "124-124-1241"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Jeff"; $client->lname = "Beck"; $client->email = "*****@*****.**"; $client->dob = "6/24/1944"; $client->gender = "Male"; $client->city = "Los Angeles"; $client->state = "California"; $client->phone_number = "9853518953"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "James"; $client->lname = "Bush"; $client->email = "*****@*****.**"; $client->dob = "6/17/1989"; $client->gender = "Male"; $client->city = "Baton Rouge"; $client->state = "Lousisana"; $client->phone_number = "123-123-1234"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Cristiano"; $client->lname = "Ronaldo"; $client->email = "*****@*****.**"; $client->dob = "2/5/1985"; $client->gender = "Male"; $client->city = "Baton rouge"; $client->state = "Louisiana"; $client->phone_number = "456-123-1523"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Angelina"; $client->lname = "Jolie"; $client->email = "*****@*****.**"; $client->dob = "6/4/1975"; $client->gender = "Female"; $client->city = "Baton Rouge"; $client->state = "Louisiana"; $client->phone_number = "542-234-1523"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Scarllet"; $client->lname = "Johansson"; $client->email = "*****@*****.**"; $client->dob = "11/22/1984"; $client->gender = "Female"; $client->city = "Baton Rouge"; $client->state = "Louisiana"; $client->phone_number = "123-123-1234"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Ludwig"; $client->lname = "Beethoven"; $client->email = "*****@*****.**"; $client->dob = "3/26/1827"; $client->gender = "Male"; $client->city = "Baton Rouge"; $client->state = "Louisiana"; $client->phone_number = "123-123-1235"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Wolfgang"; $client->lname = "Mozart"; $client->email = "*****@*****.**"; $client->dob = "1/27/1756"; $client->gender = "Male"; $client->city = "Baton Rouge"; $client->state = "Louisiana"; $client->phone_number = "124-124-1241"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Jeff"; $client->lname = "Beck"; $client->email = "*****@*****.**"; $client->dob = "6/24/1944"; $client->gender = "Male"; $client->city = "Baton Rouge"; $client->state = "Louisiana"; $client->phone_number = "9853518953"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "James"; $client->lname = "Bush"; $client->email = "*****@*****.**"; $client->dob = "6/17/1989"; $client->gender = "Male"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "123-123-1234"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Cristiano"; $client->lname = "Ronaldo"; $client->email = "*****@*****.**"; $client->dob = "2/5/1985"; $client->gender = "Male"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "456-123-1523"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Angelina"; $client->lname = "Jolie"; $client->email = "*****@*****.**"; $client->dob = "6/4/1975"; $client->gender = "Female"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "542-234-1523"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Scarllet"; $client->lname = "Johansson"; $client->email = "*****@*****.**"; $client->dob = "11/22/1984"; $client->gender = "Female"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "123-123-1234"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Ludwig"; $client->lname = "Beethoven"; $client->email = "*****@*****.**"; $client->dob = "3/26/1827"; $client->gender = "Male"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "123-123-1235"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Wolfgang"; $client->lname = "Mozart"; $client->email = "*****@*****.**"; $client->dob = "1/27/1756"; $client->gender = "Male"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "124-124-1241"; $client->status = 2; $client->save(); $client = new App\Client(); $client->fname = "Jeff"; $client->lname = "Beck"; $client->email = "*****@*****.**"; $client->dob = "6/24/1944"; $client->gender = "Male"; $client->city = "Austin"; $client->state = "Texas"; $client->phone_number = "9853518953"; $client->status = 2; $client->save(); }
/** * A basic test example. * * @return void */ public function testAddClientOk() { $user = App\User::first(); $client = App\Client::all()->last(); $this->actingAs($user)->withSession(['foo' => 'bar'])->visit('/')->click('Clients')->see('List of clients')->click('Add client')->type('Gica', 'Name')->type('Bradford, Laisteridge Lane, Revis Barber Halls, BD71LD', 'Address')->type('07511376542', 'PhoneNo')->type('*****@*****.**', 'Email')->press('Add client')->seeInDatabase('clients', ['Id' => $client->Id + 1]); }
}); Route::bind('mail', function ($id) { /** @var int $id */ return App\Mail::where('id', $id)->first(); }); Route::bind('client', function ($id) { /** @var int $id */ return App\Client::where('id', $id)->first(); }); Route::bind('subject', function ($name) { /** @var string $id */ return new App\Http\Forum\Subject($name); }); Route::bind('recipient', function ($id) { /** @var int $id */ return App\Client::where('id', $id)->first(); }); Route::bind('event', function ($id) { /** @var int $id */ return App\Event::where('id', $id)->first(); }); Route::bind('notice', function ($id) { /** @var int $id */ return App\Notice::where('id', $id)->first(); }); Route::bind('group', function ($username) { /** @var int $id */ return App\Group::where('username', $username)->first(); }); Route::bind('folder', function ($id) { /** @var int $id */
| Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', 'WelcomeController@index'); Route::get('dashboard', 'PagesController@dashboard'); Route::get('login', 'PagesController@login'); Route::get('home', function () { if (Auth::guest()) { return Redirect::to('login'); } else { return view('pages.dashboard')->with('users', App\User::all())->with('task_categories', App\TaskCategory::all())->with('tasks', App\Task::all())->with('companies', App\Company::all())->with('contracts', App\Contract::all())->with('solutions', App\Solution::all())->with('clients', App\Client::all())->with('employees', App\Employee::all()); } }); // model routes.. Route::post('tc/store', 'TaskCategoryController@store'); Route::post('tc/edit/{id}', array('uses' => 'TaskCategoryController@edit', 'as' => 'route.edit')); Route::patch('tc/{id}', array('uses' => 'TaskCategoryController@update', 'as' => 'route.update')); Route::delete('tc/{id}', array('uses' => 'TaskCategoryController@destroy', 'as' => 'route.destroy')); Route::post('task/store', 'TaskController@store'); Route::post('task/edit/{id}', array('uses' => 'TaskController@edit', 'as' => 'task.edit')); Route::post('task/approve/{id}', array('uses' => 'TaskController@approve', 'as' => 'task.approve')); Route::patch('task/{id}', array('uses' => 'TaskController@update', 'as' => 'task.update')); Route::delete('task/{id}', array('uses' => 'TaskController@destroy', 'as' => 'task.destroy')); Route::post('client/store', 'ClientController@store'); Route::post('client/edit/{id}', array('uses' => 'ClientController@edit', 'as' => 'client.edit')); Route::patch('client/{id}', array('uses' => 'ClientController@update', 'as' => 'client.update'));
/** * A basic functional test example. * * @return void */ public function testAddCarOk() { $user = App\User::first(); $this->actingAs($user)->withSession(['foo' => 'bar'])->visit('/')->click('Cars')->see('List of cars')->click('Add car')->type('DB05RON', 'LicencePlate')->select(App\Client::first()->Id, 'ClientId')->type('', 'Model')->press('Add car')->seeInDatabase('cars', ['LicencePlate' => 'DB05RON']); }