Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(App\QuestionCategory::class)->create(['name' => 'first category']);
     factory(App\QuestionCategory::class)->create(['name' => 'second category']);
     // Generate users
     factory(App\User::class, 2)->create()->each(function ($user) {
         // Generate trial period
         \App\UserTrialPeriod::create(['user_id' => $user->id, 'trial_period_id' => \App\TrialPeriod::first()->id]);
         // Settings
         $user->settings()->save(factory(App\UserSetting::class)->make(['user_id' => $user->id, 'language_id' => 1]));
         // Generate notifications
         $notifications = \App\Notification::all();
         foreach ($notifications as $notification) {
             $user->notifications()->save(factory(\App\UserNotification::class)->make(['user_id' => $user->id, 'notification_id' => $notification->id]));
         }
         // Bills per user
         $rows = 12;
         // Products per bill
         $productsPerBill = 5;
         for ($i = 0; $i < $rows; $i++) {
             // Generate client
             $client = $user->clients()->save(factory(App\Client::class)->make());
             // Generate bill for that client
             $bill = $user->bills()->save(factory(App\Bill::class)->make(['client_id' => $client->id]));
             // Generate products
             for ($j = 0; $j < $productsPerBill; $j++) {
                 $product = $user->products()->save(factory(App\Product::class)->make());
                 $bill->products()->save(factory(App\BillProduct::class)->make(['product_id' => $product->id]));
                 $applicationProduct = factory(App\ApplicationProduct::class)->create();
                 $bill->applicationProducts()->save(factory(App\BillApplicationProduct::class)->make(['product_id' => $applicationProduct->id]));
             }
         }
     });
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $device = Device::findOrFail($id);
     $notifications = Notification::all();
     return View('devices.show', compact('device', 'notifications'));
 }
Пример #3
0
 public function index(Manager $fractal, NotificationTransformer $notificationTransformer)
 {
     // show all
     $records = Notification::all();
     $collection = new Collection($records, $notificationTransformer);
     $data = $fractal->createData($collection)->toArray();
     return $this->respond($data);
 }
Пример #4
0
 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $tasks = Notification::all();
     foreach ($tasks as $task) {
         $schedule->call(function () use($task) {
             Event::fire(new NotifyUsers($task->receiver, $task->message));
         })->cron($task->cron);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Sentinel::hasAccess('notification.view')) {
         $notifications = Notification::all();
         return view('notifications.notifications.notifications', compact('notifications'));
     } else {
         return back()->withErrors(['NoAccess' => 'No tiene permisos para acceder a esta area.']);
     }
 }
 public function index()
 {
     //get authenticated user
     //return \Auth::user();
     //return 'get all new info';
     $notifications = Notification::all();
     //return $notifications;
     //Get the latest added and put at the top
     //$notifications = Notification::latest('date')->notified()->get();
     return view('notifies.index', compact('notifications'));
     //return view('notifies.index');
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $notifications = Notification::all();
     return View('notifications.index', compact('notifications'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $notifications = Notification::all();
     $actions = ActionSchema::getActionSchema($this->module);
     return view('backend.notification.index')->with('content_title', 'Notifications')->with('notifications', $notifications)->with('actions', $actions)->with('module', $this->module);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     return response()->json(Notification::all()->last());
 }