This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App\Http\Controllers; | |
// .... | |
public static function sanitizeAndPrepareForRegexSearch($searchQuery) | |
{ | |
// General input sanitization | |
$sanitized = trim(filter_var($searchQuery, FILTER_SANITIZE_STRING)); | |
// Reserved chars for regex operator | |
$excludedChars = config('app.excluded_chars'); // ['(', ')', '[', ']', '#', '@', '?', '!', '_', '-', '/', '\\', '^', '~'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- .... --> | |
<!-- UTM params --> | |
<input type="hidden" name="utm_source" value="{{ session('utm_source') }}"> | |
<input type="hidden" name="utm_medium" value="{{ session('utm_medium') }}"> | |
<input type="hidden" name="utm_campaign" value="{{ session('utm_campaign') }}"> | |
<input type="hidden" name="utm_term" value="{{ session('utm_term') }}"> | |
<input type="hidden" name="utm_content" value="{{ session('utm_content') }}"> | |
<!-- Other handy inputs for marketing ROIs --> | |
<input type="hidden" name="url" value="{{request()->url()}}"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
class Kernel extends HttpKernel | |
{ | |
// ..... | |
// ..... | |
// ..... | |
protected $routeMiddleware = [ | |
// ..... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Traits; | |
use Illuminate\Database\Eloquent\Builder; | |
trait HasStatuses | |
{ | |
const STATUS_DRAFT = 0; | |
const STATUS_ACTIVE = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Models\Post; | |
use App\Traits\HasUuid; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
// Example models. | |
use App\Models\Post; | |
use App\Models\Taxonomy; | |
use App\Models\University; | |
use App\Models\LanguageInstitute; | |
use App\Models\Exam; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Traits; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Http\Request; | |
trait HasUuid | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
// ... | |
// Remember to import it | |
use App\Traits\HasUuid; | |
class Post extends Model | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | |
use Illuminate\Foundation\Bus\DispatchesJobs; | |
use Illuminate\Foundation\Validation\ValidatesRequests; | |
use Illuminate\Routing\Controller as BaseController; | |
class Controller extends BaseController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
class Post extends Model implements HasMedia, ShouldHaveTypes | |
{ | |
// ... | |
// Add/override the boot function | |
protected static function boot() |
NewerOlder