Tag Archives: laravel

Laravel 4 htaccess vhost NotFoundHttpException issue on wamp

Questions: I have installed a local copy of Laravel 4 on WAMP, windows 7 64-bit, running apache2.4 and php5.4. I have set up a virtualhost for this project, as follows: <VirtualHost *:80> DocumentRoot “c:/Google Drive/project/public” ServerName project <directory “c:/Google Drive/project/public”> Options Indexes FollowSymLinks AllowOverride all Require all granted </directory> </VirtualHost> Everything works correctly when I… Read More »

Loading more eloquent hasMany relation queries through ajax in Laravel?

Questions: On my site, users can post “statuses”, and other users can reply/comment on those statuses. On the front page of my site, for example, I have the most liked statuses of the past 3 days displayed. In my HomeController.php: $statuses = Status::where(‘is_image’, 1) ->where(‘is_mature’, 0) ->where(‘created_at’, ‘>=’, Carbon::now()->subHours(168)) ->orderBy(‘like_count’, ‘desc’) ->take(6) ->get(); Statuses can… Read More »

Return a view via ajax in laravel

Questions: I want to display a view to the user whenever user clicks on a button using ajax. This is my code. // BASE = localhost/project/public/ $(‘#button’).click(function() { $.ajax({ url: BASE + “user/settings”, type: ‘GET’ }) .done(function( data ) { console.log( data ); }); }); And my routes.php Route::get(‘user/settings’, ‘UserController@getSettings’); And UserController.php public function getSettings(){… Read More »

Faster insert record to database from excel file Laravel 5

Questions: I am making a module which you upload records on a database from an excel file. Those are just phone numbers. So here’s my code: $file = Input::file(‘file’); Excel::load($file, function($reader) { // Getting all results $results = $reader->get()->toArray(); //var_dump($results);exit; foreach ($results as $key => $value) { $phone = new Phone(); $phone->msisdn = $value[‘msisdn’]; $phone->save();… Read More »

Apache Mod Rewrite For Laravel

Questions: I have an installation of Laravel on Wampserver. The directory is as follows: C:\wamp\www\laravel Now URLs are like this: http://localhost/laravel/public/index.php/home/index So I used the following htaccess code Options +FollowSymLinks Options -indexes DirectoryIndex index.PHP RewriteEngine on RewriteCond $1 !^(index\.PHP|images|robots.txt) RewriteCond %{REQUEST_ FILENAME} !-f RewriteCond %{REQUEST_ FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L, QSA] To reduce the… Read More »

Laravel quick start guide route not working

Questions: Ok I’m new to Laravel so went straight to the documentation to get started. There are massive holes in the documentation so it took a lot of effort and googling to fill the gaps in order to get Laravel set-up. I now have it set up and moved on to the next step in… Read More »

Laravel 5.5 ajax call 419 (unknown status)

Questions: I do an ajax call but I keep getting this error: 419 (unknown status) No idea what is causing this I saw on other posts it has to do something with csrf token but I have no form so I dont know how to fix this. my call: $(‘.company-selector li > a’).click(function(e) { e.preventDefault();… Read More »

Laravel – Session store not set on request

Questions: I recently created a new Laravel project and was following along the guide on Authentication. When I visit either my login or register route, I get the following error: ErrorException in Request.php line 775: Session store not set on request. (View: C:\Users\Matthew\Documents\test\resources\views\auth\register.blade.php) I haven’t edited any core Laravel files, I’ve only created the views… Read More »