Skip to content

Instantly share code, notes, and snippets.

View nasirkhan's full-sized avatar
🚀
Focusing

Nasir Khan Saikat nasirkhan

🚀
Focusing
View GitHub Profile
@nasirkhan
nasirkhan / laravel-pagination-code.php
Created February 24, 2017 08:17
get parameters with pagination, laravel 5
<?php
// get parameters with pagination, laravel 5
// http://stackoverflow.com/questions/17159273/laravel-pagination-links-not-including-other-get-parameters
{!! $myItems->appends(Request::capture()->except('page'))->render() !!}
?>
@nasirkhan
nasirkhan / laravel-clean-compiled-cached.sh
Created February 19, 2017 07:57
laravel-clean-compiled-cached
# clear cache
php artisan cache:clear
#clear compiled
php artisan clear-compiled
#dump auto load files
composer dump-autoload
@nasirkhan
nasirkhan / atom.sh
Created January 28, 2017 05:02
Atom crashes, could not open the window.
atom --clear-window-state
@nasirkhan
nasirkhan / configure-server-datetime.sh
Created December 3, 2016 04:07
Configure the ubuntu server timezone
# Set the Uubntu server Timezone
sudo dpkg-reconfigure tzdata
# check the server time
timedatectl
@nasirkhan
nasirkhan / install-composer.sh
Created November 7, 2016 15:22
install Composer on Ubuntu
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
@nasirkhan
nasirkhan / controller.php
Created October 30, 2016 05:57
Add element to Laravel Request object
<?php
/*
* Add element to Laravel Request object,
*/
$request->merge(array('new_value' => 'New Value Text'));
?>
@nasirkhan
nasirkhan / command.sh
Last active October 22, 2016 03:18
Setup Apache, PHP, MySQL on Ubuntu
sudo apt-get install php-curl
sudo apt-get install zip
sudo a2enmod rewrite
sudo service apache2 restart
@nasirkhan
nasirkhan / laravel-commans.md
Last active July 22, 2020 11:56
Call laravel routes via command line

http://stackoverflow.com/questions/28866821/call-laravel-controller-via-command-line

There is no way so far (not sure if there will ever be). However you can create your own Artisan Command that can do that. Create a command CallRoute using this:

php artisan make:console CallRoute

This will generate a command class in app/Console/Commands/CallRoute.php. The contents of that class should look like this:

<?php namespace App\Console\Commands;
@nasirkhan
nasirkhan / laravel-controller-method-commands.php
Last active March 31, 2023 04:11
Call Laravel Controller methods via command line
<?php
php artisan tinker
$controller = app()->make('App\Http\Controllers\MyController');
app()->call([$controller, 'myMethodName'], []);
//the last [] in the app()->call() can hold arguments such as [user_id] => 10 etc'
@nasirkhan
nasirkhan / www-html-file-permission-fix.md
Last active December 29, 2021 08:01
Correct permissions for /var/www and laravel wordpress

First, you should ensure that your username is included in www-data group. If not, you can add your username as www-data group

sudo adduser $USER www-data

After that, you should change the ownership of /var/www to your username

sudo chown $USER:www-data -R /var/www

Next step, you should change permission to 755 (rwxr-xr-x), not recommend changing permission to 777 for security reason