laravel snippets,etc...
In Laravel, instead of adding the service provider in the config/app.php file, you can add the following code to your app/Providers/AppServiceProvider.php file, within the register() method:
public function register()
{
if ($this->app->environment() !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
// ...
}
# Avoid laravel RewriteCond for Chat folder
RewriteCond %{REQUEST_URI} "/chat/"
RewriteRule (.*) $1 [L]
# Laravel RewriteCond
RewriteRule ^(.*)/$ /$1 [L,R=301]
# make Public folder as a root
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/website
</IfModule>
<Files php.ini>
order allow,deny
deny from all
</Files>
#Assign PHP version
<IfModule mod_suphp.c>
AddType application/x-httpd-php56 .php5 .php4 .php .php3 .php2 .phtml
suPHP_ConfigPath /usr/local/lib/php56.ini
</IfModule>
$msgs = $msgs_from->merge($msg_to)->sortByDesc('created_at');
class Model extends Model{
public function newQuery()
{
return parent::newQuery()->where('statue', '!=', 0);
}
// Now your Model::all() will only output your news with status = 1.
}
$factory->define(App\Product::class, function (Faker\Generator $faker) {
return [
'title' => $faker->sentence(),
'image' => 'http://loremflickr.com/400/300?random='.rand(1, 100),
'price' => $faker->numberBetween(3, 100),
'description' => $faker->paragraph(2)
];
});