コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (DB::table('parcels_towns')->whereTownsId($id)->count() > 1) {
         alert()->info('Town could not be deleted because it has a record', 'Oops');
         return redirect('town');
     }
     DB::table('parcels_towns')->whereTownsId($id)->delete();
     Towns::destroy($id);
     alert()->success('Town deleted successfully', 'Success');
     return redirect('town');
 }
コード例 #2
0
 public function getTrack(Parcels $parcel)
 {
     $towns = Towns::lists('name', 'id')->all();
     $statuses = Status::where('id', '>', 1)->lists('status', 'id')->all();
     return view('parcel.track', compact('parcel', 'towns', 'statuses'));
 }
コード例 #3
0
 public function getTrack(Batch $batch)
 {
     $towns = Towns::lists('name', 'id')->all();
     $statuses = Status::where('id', '>', 1)->lists('status', 'id')->all();
     return view('batch.track', compact('batch', 'towns', 'statuses'));
 }
コード例 #4
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('layouts.dashboard', function ($view) {
         $view->with('parcels', Parcels::all())->with('deliveredparcels', Parcels::take(5)->latest()->where('status_id', '=', 4)->get())->with('undeliveredparcels', Parcels::take(5)->latest()->where('status_id', '!=', 4)->get())->with('users', User::all()->count())->with('towns', Towns::all()->count())->with('shipments', ParcelsTowns::all()->count());
     });
 }