laravel-5.2

Laravel dynamic breadcrumbs with links

人走茶凉 提交于 2019-11-29 07:56:48
I am trying to implement dynamic breadcrumbs in laravel with links. I successfully render the breadcrumbs but without links by following code. <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i>Marketplace</a></li> @foreach(Request::segments() as $segment) <li> <a href="#">{{$segment}}</a> </li> @endforeach </ol> But now i am facing issue with the urls. I am getting the current url of the route with all the decendents. Can someone please help me that how can I add links to the breadcrumbs ? Thanks. If I understand your issue correctly, you just need to fill in the URL of

How to put route in anchor tag in laravel 5.2

久未见 提交于 2019-11-29 07:55:34
I've gone through many of the articles below, which explains generating link from named route, but unable to solve my problem. Tutorial 1 Tutorial 2 Tutorial 3 Following is the defined routes: Route::get('/nitsadmin/dashboard', function () { return view('nitsadmin.dashboard'); }); And I'm calling link in anchor tag: <a id="index" class="navbar-brand" href="{{Html::linkRoute('/nitsadmin/dashboard')}}"> <img src="../img/admin/nitseditorlogo.png" alt="Logo"> </a> I'm getting following error: You can do this quite simply with the url() helper. Just replace your anchor tag like so: <a id="index"

Run function from Button or URL in Laravel

夙愿已清 提交于 2019-11-29 05:17:51
I have the following test function, that I want to call directly from my URL or by clicking a link from my blade view. public function callMeDirectlyFromUrl() { return "I have been called from URL :)"; } My Question: Is it possible to call a function directly from button-click or URL link from blade view in Laravel? Here is the solution: We assume you have a function callMeDirectlyFromUrl in YourController , here how you can call the function directly from URL, Hyperlink or Button. Create Route Route::get('/pagelink', 'YourController@callMeDirectlyFromUrl'); Add link in the view blade php file

Laravel 5.2 Session flash not working even with web middleware

為{幸葍}努か 提交于 2019-11-29 03:40:49
问题 I am trying to implement flash messaging using sessions but am unable to do so. In my controller I have: public function store(Request $request) { session()->flash('donald', 'duck'); session()->put('mickey', 'mouse'); return redirect()->action('CustomerController@index')->with('bugs', 'bunny'); } But when I check the session variables in the view, I can only see the values from session()->put('mickey', 'mouse') . Session: {"_token":"F6DoffOFb17B36eEJQruxvPe0ra1CbyJiaooDn3F","_previous":{"url"

Validating multiple files in array

↘锁芯ラ 提交于 2019-11-29 03:32:26
I need to validate multiple uploaded files, making sure they are of a specific type and under 2048kb. The below doesn't appear to check all files in the array 'files' and just presumes the posted files of invalid mime type as it seems to be checking the array object and not its contents. public function fileUpload(Request $request) { $validator = Validator::make($request->all(), [ 'files' => 'required|mimes:jpeg,jpg,png', ]); if ($validator->fails()) { return response()->json(array( 'success' => false, 'errors' => $validator->getMessageBag()->toArray() ), 400); } } You can validate file array

How to resolve the error “[ErrorException] file_get_contents(/var/www/laravel/.env): failed to open stream: No such file or directory”?

荒凉一梦 提交于 2019-11-29 03:14:37
I'm using Ubuntu 14.04 on my machine. I installed composer and then laravel in the document root i.e. /var/www I also gave -R 777 persmission to folder laravel present in directory /var/www Then I go to directory laravel using cd /var/www/laravel and run the following command php artisan and I got to see all the available commands there. Then I typed in php artisan key:generate and got the error [ErrorException] file_get_contents(/var/www/laravel/.env): failed to open stream: No such file or directory Here I got stuck actually, can someone please help me in this regard? Thanks. Rename .env

How to run Laravel from root directory, not from public?

十年热恋 提交于 2019-11-29 02:44:48
By default, Laravel project is run from public directory, for this I must enter URL like as: http://localhost/public/ How to configure Laravel that website will be appeared from: http://localhost/ ? •Go to mainproject/public>> a. .htacess b. favicon.ico c. index.php d. robots.txt e. web.config 1.cut these 5 files from the public folder, and then paste on the main project folder that’s means out side of public folder… mainproject/files 2.Next after paste ,open index.php ,modify •require __DIR__.'/…/bootstrap/autoload.php'; to •require __DIR__.'/bootstrap/autoload.php'; modify $app = require

Laravel : How to hide url parameter?

南楼画角 提交于 2019-11-29 02:25:22
Here the scenario is I want to pass a variable which will be send from one page to another and in next page it's gonna store through a form. So I have passed the variable from first page to second page through the URL. But I want to hide the parameter in the URL. How do I do it? Here is my route : Route::get('/registration/{course_id}',[ 'uses'=>'AppController@getregistration', 'as'=>'registration' ]); And Controller : public function getregistration($course_id) { return view('index')->with('course_id',$course_id); } And first page this is how I send the value to first page: <li> <a href="{

FatalErrorException in HtmlServiceProvider.php line 36: laravel

梦想的初衷 提交于 2019-11-29 01:38:21
I am using laravel 5.2 and I am getting following error FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared() my app.php file is <?php return [ 'env' => env('APP_ENV', 'production'), 'debug' => env('APP_DEBUG', false), 'url' => 'http://localhost', 'timezone' => 'UTC', 'locale' => 'en', 'fallback_locale' => 'en', 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', 'log' => env('APP_LOG', 'single'), 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Auth\AuthServiceProvider::class, Illuminate

Laravel 5.2: Auth::logout() is not working

血红的双手。 提交于 2019-11-29 01:36:21
I'm building a very simple app in Laravel 5.2, but when using AuthController 's action to log out, it just simply doesn't work. I have a nav bar which checks for Auth::check() and it doesn't change after calling the log out action. I have this route inside the routes.php file: Route::get('users/logout', 'Auth\AuthController@getLogout'); and it's outside the Route::group(['middleware' => ['web']], function () statement. I did also try to add the follow action at the end of the AuthController.php file. public function getLogout() { $this->auth->logout(); Session::flush(); return redirect('/'); }