Example #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $coupon = Coupon::findOrFail($id);
     $coupon->delete();
     return Redirect::route('admin.coupon.index');
 }
Example #2
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     //        $router->model('user' , 'App\User');
     $router->bind('user', function ($value) {
         return User::with('roles')->findOrFail($value);
     });
     /**
      * created by dara on 6/9/2015
      * add binding for admin wild card
      */
     $router->bind('admin', function ($value) {
         return User::with('roles')->findOrFail($value);
     });
     /**
      * Created by Emad Mirzaie on 09/09/2015.
      * province wild cart
      */
     $router->model('province', 'App\\Province');
     $router->model('city', 'App\\Province');
     $router->model('university', 'App\\University');
     $router->model('article', 'App\\Article');
     $router->model('post', 'App\\Post');
     $router->model('category', 'App\\Category');
     $router->model('sub_category', 'App\\Category');
     $router->model('skill', 'App\\Skill');
     $router->model('profile', 'App\\User');
     $router->model('comment', 'App\\Comment');
     $router->model('poll', 'App\\Poll');
     $router->model('questionnaire', 'App\\Questionnaire');
     $router->model('coupon_user', 'App\\CouponUser');
     $router->model('showcase', 'App\\Showcase');
     $router->model('sticky', 'App\\Sticky');
     /**
      * Created By Dara on 22/10/2015
      */
     //        $router->bind('offer',function($value){
     //            return Offer::findOrFail($value);
     //        });
     $router->bind('service', function ($value) {
         return CouponGallery::findOrFail($value);
     });
     $router->bind('coupon', function ($value) {
         return Coupon::findOrFail($value);
     });
     $router->bind('group', function ($value) {
         return Group::findOrFail($value);
     });
     $router->bind('problem', function ($value) {
         return Problem::findOrFail($value);
     });
     $router->model('offer', 'App\\Offer');
     $router->model('shop', 'App\\Shop');
     $router->model('product', 'App\\Product');
     $router->bind('event', function ($value) {
         return Event::findOrFail($value);
     });
     $router->bind('settle', function ($value) {
         return Settle::findOrFail($value);
     });
     $router->bind('report', function ($value) {
         return Report::findOrFail($value);
     });
     $router->bind('corporation', function ($value) {
         return Corporation::findOrFail($value);
     });
     /**
      * Created By Dara on 25/12/2015
      */
     $router->bind('announcement', function ($value) {
         return Announcement::findOrFail($value);
     });
     $router->bind('storage', function ($value) {
         return Storage::findOrFail($value);
     });
     $router->bind('role', function ($value) {
         return Role::findOrFail($value);
     });
 }
Example #3
0
 public function update(Request $request)
 {
     Coupon::findOrFail($request->input('pk'))->update([$request->input('name') => $request->input('value')]);
 }