laravel-4

Laravel htaccess

微笑、不失礼 提交于 2019-12-25 10:56:13
问题 I've setup a new install of Laravel on my local. It appears there are issues with htaccess or Apache settings. I've researched for a number of hours and tried everything I read. OSX Lion 10.7.5 MAMP 3.0.5 PHP 5.5.10 mod_rewrite is being loaded. My development server works with other sites. This is the first time I am trying Laravel 4. I get a 403 Forbidden on the welcome page which is located at website.dev:8888/ Apache gives me this error: Directory index forbidden by Options directive Here

Laravel htaccess

烂漫一生 提交于 2019-12-25 10:55:23
问题 I've setup a new install of Laravel on my local. It appears there are issues with htaccess or Apache settings. I've researched for a number of hours and tried everything I read. OSX Lion 10.7.5 MAMP 3.0.5 PHP 5.5.10 mod_rewrite is being loaded. My development server works with other sites. This is the first time I am trying Laravel 4. I get a 403 Forbidden on the welcome page which is located at website.dev:8888/ Apache gives me this error: Directory index forbidden by Options directive Here

Laravel get count of results based on groupBy

我怕爱的太早我们不能终老 提交于 2019-12-25 09:34:50
问题 The following is the structure of my database id name country province status updated_at 1 A US TX 2 [timestamp] 2 B UK LON 1 [timestamp] 3 C US TX 2 [timestamp] 4 D US WA 2 [timestamp] 5 E US WA 3 [timestamp] 6 F US WA 2 [timestamp] 7 G US TX 1 [timestamp] Information from the form (search criteria) country (US) in this example Start date, End date I need to get the following count and information. Group by province { $ca = count(status '1') $cb = count(status '2') $cc = count(status '3') }

laravel query: orWhere: double condition

倖福魔咒の 提交于 2019-12-25 07:58:30
问题 I have the following query, which does not give me the expected result: $query = $query->join('events_dates', function($join) use ($data){ $join->on('events.id', '=', 'events_dates.event_id') ->where('events_dates.start_date', "<=", date_format(date_create($data['date_end']), "Y-m-d")) ->where('events_dates.end_date', '>=', date_format(date_create($data['date_start']), "Y-m-d")) ->orWhere('recurrent', "=", 1) ->where((strtotime($data["date_start"]) - strtotime('event_dates.start_date')) % (

laravel query: orWhere: double condition

会有一股神秘感。 提交于 2019-12-25 07:56:38
问题 I have the following query, which does not give me the expected result: $query = $query->join('events_dates', function($join) use ($data){ $join->on('events.id', '=', 'events_dates.event_id') ->where('events_dates.start_date', "<=", date_format(date_create($data['date_end']), "Y-m-d")) ->where('events_dates.end_date', '>=', date_format(date_create($data['date_start']), "Y-m-d")) ->orWhere('recurrent', "=", 1) ->where((strtotime($data["date_start"]) - strtotime('event_dates.start_date')) % (

How to query only by month on date input and ignore the year and day considering indexing or performance on database in laravel

为君一笑 提交于 2019-12-25 07:54:50
问题 I have this table training_schedules id course_reference start_date(date) end_date(date) year_id(int, fk) on my form, I have dropdownlist for the month, and another one for the year. Now as you can see there is a mismatch on the month from form and database column . How can I filter the start_date or end_date column using only the integer value from the dropdownlist and ignore the day and year part of the db column? I saw some examples but using raw query and using date functions of database

Using a function from a model in a controller/view in Laravel

。_饼干妹妹 提交于 2019-12-25 07:37:26
问题 I am trying to access data from a query that I have placed within a function in a model. I am trying to call the function within a controller, and then send along that data to a view. So far, I have been unsuccessful. Here is the code: Model: Fanartist.php public function fan_likes() { $fan_likes = DB::table('fanartists') ->join('artists', 'fanartists.fan_id', '=', 'artists.id') ->where('fanartists.fan_id', '=', Auth::user()->id) ->select('artists.id', 'artists.stage_name', 'artists.city',

Using CSRF in Laravel

旧时模样 提交于 2019-12-25 07:03:37
问题 Here is my CSRF as hidden <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"> And my csrf is generated as usual While i am passing into route for a controller Here is my old route Route::post('register', 'RegisterController@registeruser'); And to make it with csrf Route::post('register', array('before' => 'csrf', function() { return 'You gave a valid CSRF token!'; })); as per the Laravel Docs While i routing it to the controller Route::post('register', array('before' =>

Laravel 4.2 - Disabling Set-Cookie Header for OPTIONS responses

六月ゝ 毕业季﹏ 提交于 2019-12-25 06:59:28
问题 I have a stateless API built with Laravel. I use the following filter to prevent the Set-Cookie header from being sent back to the requester on all requests: Route::filter('auth.firewall', function(){ Config::set('session.driver', 'array'); }); My API is called from a different sub-domain than the one it's hosted at and an OPTIONS request is sent from the client before any RESTful request. On the response to these OPTIONS requests, Laravel is still sending a Set-Cookie header. How would I

How to install Laravel 4 profiler

可紊 提交于 2019-12-25 06:34:17
问题 I'm a Ubuntu/git/composer noob, and I'm trying to follow the installation instructions here. After running the php artisan config:publish loic-sharma/profiler command I get the following error: PHP Fatal error: Class 'Profiler\ProfilerServiceProvider' not found in /var/www/epcr/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 158 I'm assuming the problem is that I haven't downloaded the code, but I'm not exactly sure how to go about doing that. 回答1: Most