/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $loais = $this->loai->all();
     $chungloai = Chung_loai::get();
     $hang = Hang::get();
     $input = Input::all();
     $validation = Validator::make($input, Loai::$rules);
     if ($validation->passes()) {
         $model = $this->loai->create($input);
         Logfileadmin::addData("Thêm", "Loại", $model->id, $model->tenloai);
         return Redirect::route('loais.index');
     }
     return Redirect::route('loais.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.')->with('chungloai', $chungloai)->with('hang', $hang);
 }
Esempio n. 2
0
    Route::get("logfile", function () {
        $logs = Logfileadmin::orderBy("created_at", "desc")->paginate(15);
        return View::make('logfile.logfile')->with('logs', $logs);
    });
});
Route::group(array("before" => "checkUser"), function () {
    Route::controller('dat_hang', 'DondathangController');
    Route::controller('nhap', 'NhapController');
    Route::controller('sanpham', 'SanphamController');
    Route::controller('gia', 'GiaController');
    Route::resource('hangs', 'HangsController');
    Route::resource('chung_loais', 'Chung_loaisController');
    Route::resource('nguoi_dungs', 'Nguoi_dungsController');
    Route::resource('loais', 'LoaisController');
    Route::resource('trangthais', 'TrangthaisController');
    Route::resource('vanchuyens', 'VanchuyensController');
});
Route::controller('check', 'CheckController');
//*****************************************************************************************************************88
//* Đăng Ký ********************************************************************************************
Route::controller('users', 'UsersController');
/************************************************************************************************/
// User *******************************************************************************************************
Route::get("/", function () {
    $chungloai = Chung_loai::all();
    $loai = Loai::all();
    $spHightView = DB::table('giaapdung')->orderBy('luotxem', 'desc')->limit(2)->get();
    $sps = DB::table('giaapdung')->orderBy('id', 'desc')->limit(12)->get();
    $allsp = DB::table('giaapdung')->orderBy('id', 'desc')->paginate(12);
    return View::make('users/home')->with('chungloais', $chungloai)->with('loais', $loai)->with('spHightViews', $spHightView)->with('sps', $sps)->with('allsp', $allsp);
});
 public function getDoiMatkhau()
 {
     if (Session::has('taikhoan')) {
         $chungloai = Chung_loai::all();
         $loai = Loai::all();
         return View::make('users.changepass')->with('chungloais', $chungloai)->with('loais', $loai);
     } else {
         return Redirect::to('/');
     }
 }