예제 #1
0
 public function index()
 {
     $user = User::lists('name', 'id');
     $allevents = Shop::all();
     $events = array();
     foreach ($allevents as $shop) {
         $start = date('Y') . '-' . date('m-d', strtotime($shop->shopdate));
         $title = $shop->user->name;
         $color = '#133edb';
         $events[] = array('title' => $title, 'start' => $start, 'color' => $color);
     }
     return view('shops.index', ['user' => $user, 'events' => $events]);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     /**this method selects rules from database and bind to this view whenever it is used */
     view()->composer('partials/dashboardleftcolumn', function ($view) {
         $view->with('rules', \App\Rule::all(['rule_name', 'controller']));
     });
     view()->composer('partials/foodpartial', function ($view) {
         $view->with('items', \App\Item::all());
         //->where(['state',1]);
     });
     view()->composer('menu', function ($view) {
         $view->with('messages', \App\Item::all());
         //->where(['state',1]);
     });
     view()->composer('partials/productform', function ($view) {
         $id = Auth::user()->user_id;
         $view->with('shops', \App\Shop::all()->where('user_id', $id));
     });
 }
예제 #3
0
 private function saveArticle(Article $article)
 {
     $article->shop_id = \App\Shop::all()->first()->id;
     if ($article->model_id == '') {
         $article->model_id = null;
     }
     if ($article->brand_id == '') {
         $article->brand_id = null;
     }
     if ($article->part_type_id == '') {
         $article->part_type_id = null;
     }
     // this automatically applies the user id for
     //the relations ship
     //TODO: rever isto para associar a peça à loja de que o user é dono;
     $article->save();
 }
예제 #4
0
 /**
  * upload the specified resource from storage.
  *
  * @return Response::Download as txt file
  */
 public function upload()
 {
     $filename = Input::file('file');
     if (File::exists($filename)) {
         try {
             $file = fopen("{$filename}", "r");
             $row = array();
             while (!feof($file)) {
                 $row = fgets($file);
                 $split_row = explode(',', $row);
                 if (count($split_row) > 1) {
                     $this->processRow($split_row);
                 }
             }
             fclose($file);
         } catch (Illuminate\Filesystem\FileNotFoundException $exception) {
             die("The file doesn't exist");
         }
     }
     $shops = Shop::all();
     return \View::make('mall')->with('shops', $shops);
 }
예제 #5
0
 public function index()
 {
     $objects = Shop::all();
     $attributes = ['Name', 'Address', 'Contact_no', 'Email', 'Others_info'];
     return view('shops.index', compact('objects', 'attributes'));
 }