Skip to content

Instantly share code, notes, and snippets.

@ercanertan
ercanertan / whm-change-document-root.md
Created July 14, 2017 10:21 — forked from Bodom78/whm-change-document-root.md
WHM/cPanel - Changing an accounts document root

To properly edit an accounts DocumentRoot go to /var/cpanel/userdata/username/ (replace username with the actual cPanel username for the account), then edit the file domain.com (where domain.com is your primary domain name).

You will see something like this in that file:

documentroot: /home/username/public_html

You will also see the cgi-bin area in this section:

scriptalias:
@ercanertan
ercanertan / MAC OSX Apache-Php setup.txt
Last active October 16, 2017 12:43
Mac OSX Apache Setup
Find username
$ id
Go /etc/apache2/users/ and edit or create username.conf like below
<Directory "/Users/username/Sites/">
AddLanguage en .en
AddHandler perl-script .pl
PerlHandler ModPerl::Registry
@ercanertan
ercanertan / mysql_export_import_for_laravel.txt
Last active October 16, 2017 13:01
Mysql Export/Import for Laravel
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
//Export
$process = new Process('mysqldump -u'.env('DB_USERNAME').' -p'.env('DB_PASSWORD').' '.env('DB_DATABASE').' > db-backups/'.Carbon::now()->timestamp.'.sql');
//Import (on production add password as well '-p'.env('DB_PASSWORD'))
$process = new Process('mysql -u'.env('DB_USERNAME').' '.env('DB_DATABASE').' '.'< db-backups/1508156934.sql');
@ercanertan
ercanertan / Popup_Example.blade.php
Last active December 13, 2018 12:16
Popup Example
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body">
<h1>Sample</h1>
</div>
</div>
</div>
</div>
@ercanertan
ercanertan / Laravel Local.txt
Last active January 31, 2018 21:39
Laravel Local
//Route
Route::group(['middleware' => ['web','locale'], 'namespace' => 'Modules\Theme\Http\Controllers'], function()
{
Route::post('changelocale', ['as' => 'changelocale', 'uses' => 'HomeController@changeLocale']);
}
@ercanertan
ercanertan / Laravel Module Setup.txt
Last active October 12, 2018 13:32
Laravel Module Setup
1. config/auth.php
'users' => [
'driver' => 'eloquent',
'model' => Modules\User\Entities\User::class,
],
2.Create config file for env variables
return [
http://jsfiddle.net/mt8wfrq2/
Blade
<div id="accordion" role="tablist">
<div class="card">
<div class="card-header" role="tab" id="headingOne">
<h5 class="mb-0">
<a data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
@ercanertan
ercanertan / MacOSX Preparation.txt
Last active October 12, 2018 13:30
MacOSX Preparation
Install Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Mysql
brew install [email protected]
brew services start [email protected]
@ercanertan
ercanertan / Cookie Laravel.txt
Last active December 19, 2018 17:56
Cookie Laravel
@ercanertan
ercanertan / Laravel redirectTo() method
Last active December 19, 2018 17:57
Laravel redirectTo() method
// Dont use "return redirect.." because the method redirectTo should return an url path, not the Redirect response.
Example
protected function redirectTo() {
if (Auth::check() && Auth::user()->role == 'visitor') {
// Dont use redirect
// return redirect('/visitor'); // Wrong
return route('backend.visitor');