public function __construct(FreightPrice $freightprice, Truck $truck, Party $party, Station $station)
 {
     $this->truck = $truck->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
     $this->party = $party->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
     $this->station = $station->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
     $this->freightprice = $freightprice->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['truck_no' => 'required|max:255', 'state_list' => 'required', 'rc_copy_photo' => 'image|max:1024', 'insurance_photo' => 'image|max:1024', 'road_tax_photo' => 'image|max:1024', 'fitness_photo' => 'image|max:1024', 'permit_fyr_photo' => 'image|max:1024', 'permit_photo' => 'image|max:1024']);
     // dd($request->get('state_list'));
     $input = $this->getAll($request, 'store', '');
     $truck = Truck::create($input);
     $truck->state()->sync($request->get('state_list'));
     flash()->success('Truck Created Successfully !');
     return redirect('truck');
 }
Ejemplo n.º 3
0
 public function getMoveInfo($id)
 {
     $truck = Truck::with('moves')->findOrFail($id);
     $moves = $truck->moves;
     foreach ($moves as $move) {
         $crew = Crew::with('movers')->findOrFail($move->crew_id);
         $move->crew = $crew;
     }
     return response()->json($moves);
 }
Ejemplo n.º 4
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Truck::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
Ejemplo n.º 5
0
 public function destroy($id)
 {
     Truck::find($id)->delete();
     $trucks = Truck::orderBy('company')->paginate(env('TRUCK_PAGINATION_MAX'));
     return view('trucks.index')->with('trucks', $trucks);
 }
Ejemplo n.º 6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Truck $truck
  * @return \Illuminate\Http\Response
  */
 public function destroy(Truck $truck)
 {
     $truck->delete();
     Session::flash('flash_message', 'Truck deleted successfully!');
     return Redirect::route('truck.index')->with('message', 'Truck deleted.');
 }