Пример #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $data = event::find($id);
     if (Gate::denies('update', $data)) {
         return 'No eres el creador';
     } else {
         $data::destroy($id);
     }
 }
Пример #2
0
 public function contactId($id)
 {
     $info = info::where('name', 'contact')->limit(1)->get()[0];
     $helps = help::all();
     $events = event::all();
     $services = service::all();
     $checkServiceArray = eventServices::where('event_id', $id)->get();
     $checkService;
     $currEvent = event::find($id);
     foreach ($checkServiceArray as $check) {
         $checkService[] = $check->service_id;
     }
     if (!empty($currEvent)) {
         return view('pages.contact', compact('helps', 'events', 'services', 'checkService', 'currEvent', 'info'));
     }
     return redirect('/contact');
 }
Пример #3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $event = event::find($id);
     $event = $event->toArray();
     return response()->json($event);
 }
Пример #4
0
<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in 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('/', function () {
    $post = \App\post::OrderBy('id', 'ASC')->paginate(9);
    $event = \App\event::OrderBy('id', 'ASC')->paginate(9);
    $user = \App\template::OrderBy('id', 'ASC')->paginate(6);
    return view('welcome', compact('post', 'event', 'user'));
});
Route::get('/load', function () {
    return view('load');
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Пример #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $event = event::find($id);
     foreach (eventServices::where('event_id', $id)->get() as $es) {
         $es->delete();
     }
     $event->delete();
     return redirect('/');
 }