protected static function boot() { parent::boot(); Entry::creating(function ($entry) { $entry->company_id = $entry->company_id ?: Auth::user()['company_id']; }); }
public function testDelete() { $idDelete = Entry::all()->last()['id']; $this->seeInDatabase('entries', ['id' => $idDelete]); $this->visit('/entry/destroy/' . $idDelete); $this->seeIsSoftDeletedInDatabase('entries', ['id' => $idDelete]); }
public function testDeleteExecutive() { $this->get('/entry/destroy/' . Entry::all()->last()['id'])->assertResponseStatus(302); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('entries')->delete(); Entry::forceCreate(['entry_type_id' => 1, 'vendor_id' => 1, 'vehicle_id' => 1, 'datetime_ini' => '2016-01-01', 'datetime_end' => '2016-01-01', 'entry_number' => 123, 'cost' => 321, 'description' => 'Descricao Entry', 'company_id' => 1]); }
public static function getServicesStatistics() { $services['in_progress']['color'] = '#3871cf'; $services['in_progress']['result'] = Entry::join('types', 'types.id', '=', 'entries.entry_type_id')->where('entries.company_id', Auth::user()['company_id'])->where('types.entity_key', 'entry')->where('types.name', 'service')->where('entries.datetime_ini', '<=', Carbon::now())->where(function ($query) { $query->where('entries.datetime_end', '>', Carbon::now())->orWhereNull('entries.datetime_end'); })->count(); $services['foreseen']['color'] = '#cf7138'; $services['foreseen']['result'] = Entry::join('types', 'types.id', '=', 'entries.entry_type_id')->where('entries.company_id', Auth::user()['company_id'])->where('types.entity_key', 'entry')->where('types.name', 'service')->where('entries.datetime_ini', '>', Carbon::now())->count(); $services['accomplished']['color'] = '#38cf71'; $services['accomplished']['result'] = Entry::join('types', 'types.id', '=', 'entries.entry_type_id')->where('entries.company_id', Auth::user()['company_id'])->where('types.entity_key', 'entry')->where('types.name', 'service')->where('entries.datetime_end', '<=', Carbon::now())->count(); return $services; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $entries = Entry::get(); return view('entry.index', compact('entries')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $entry = Entry::get(); //return $entry; return view('eventos', compact($entry)); }