How Can I Remove “public/index.php” in the Laravel Url generated? [duplicate]

Option 1: Use .htaccess If it isn’t already there, create an .htaccess file in the Laravel root directory. Create a .htaccess file your Laravel root directory if it does not exists already. (Normally it is under your public_html folder) Edit the .htaccess file so that it contains the following code: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule … Read more

Laravel quick start guide route not working

Seems like your Laravel app is accesible via an Apache HTTP alias, because your URL looks like: http://localhost/laravel/. If this is the case and assuming that http://localhost/laravel is pointing to your public directory, then follow these steps: Try to navigate to your expected route prepend it with /index.php/, in your case: http://localhost/laravel/index.php/users. If it works … Read more

change database connection in laravel model

Different models can have different database connections. So your models use the normal default connection – but your ‘McibModel’ model can use another connection: class McibModel extends Model { protected $connection= ‘second_db_connection’; protected $table=”agencies”; } Then in your DB connection file – you would have something like this: return array( ‘connections’ => array( ‘mysql’ => … Read more

Laravel validation: exists with additional column condition – custom validation rule

From Laravel 5.3+ you can add a custom where clause to the exists and unique rules. Here is my scenario: I have an email verification table and I want to ensure that a passed machine code and activation code exist on the same row. Be sure to use Illuminate\Validation\Rule; $activationCode = $request->activation_code; $rules = [ … Read more

Change name of Laravel’s created_at and updated_at

The accepted answer may cause problems with updating timestamps unfortunately. You’d better override consts on your model: const CREATED_AT = ‘post_date’; const UPDATED_AT = ‘post_modified’; then methods getCreatedAtColumn and getUpdatedAtColumn will return post_date and post_modified respectively, but won’t do any harm. For the other columns you need use events like @Oni suggested.

Laravel Redirect All Requests To HTTPS

Using App::before You might be able to take advantage of the App::before() block in the app/filters.php file. Change the block to include a simple check to see if the current request is secure, and if not, redirect it. App::before(function($request) { if( ! Request::secure()) { return Redirect::secure(Request::path()); } }); Using Filters Another option might be to … Read more

Laravel change input value

You can use Input::merge() to replace single items. Input::merge([‘inputname’ => ‘new value’]); Or use Input::replace() to replace the entire input array. Input::replace([‘inputname’ => ‘new value’]); Here’s a link to the documentation

Using ng-if as a switch inside ng-repeat?

Try to surround strings (hoot, story, article) with quotes ‘: <div ng-repeat = “data in comments”> <div ng-if=”data.type == ‘hoot’ “> //different template with hoot data </div> <div ng-if=”data.type == ‘story’ “> //different template with story data </div> <div ng-if=”data.type == ‘article’ “> //different template with article data </div> </div>