Example #1
0
 public function handleAction(Request $request)
 {
     $action = $request->input('_action');
     if ($action == 'addModel') {
         $this->validate($request, ['name' => 'unique:models']);
         $modele = Modeles::create($request->all());
         $response = isset($modele->id) ? ['status' => 'success', 'modele_id' => $modele->id] : ['status' => 'success'];
         return response($response);
     } else {
         return response(['status' => 'error']);
     }
 }
Example #2
0
 public function index()
 {
     $modele = Modeles::with('category', 'brand')->get();
     $supp = Supplier::all();
     $articles_modeles = Article::with('theModels.brand', 'theModels.category', 'supplier')->get();
     $leftmenu['model'] = 'active';
     $leftmenu['model_article'] = 'active';
     if (isset($_GET['sel_modele'])) {
         $response = ['leftmenu' => $leftmenu, 'modeles' => $modele, 'article_modele' => $articles_modeles, 'suppliers' => $supp, 'selection' => $_GET['sel_modele']];
     } else {
         $response = ['leftmenu' => $leftmenu, 'modeles' => $modele, 'article_modele' => $articles_modeles, 'suppliers' => $supp];
     }
     return view('/articles/index', $response);
 }
Example #3
0
 public function createFile($id)
 {
     $users = User::all();
     $client = Client::where('id', $id)->get();
     $modele = Modeles::with('category', 'brand', 'articles')->get();
     $devices = Device::all();
     $articles = Article::all();
     $supp = Supplier::all();
     $categories = Category::all();
     $brands = Brand::all();
     $leftmenu['files'] = 'active';
     return view('/files/create-by-id', ['leftmenu' => $leftmenu, 'client' => $client[0], 'modeles' => $modele, 'devices' => $devices, 'articles' => $articles, 'suppliers' => $supp, 'categories' => $categories, 'brands' => $brands, 'users' => $users]);
 }