/**
* Bring our routes online.
* @return Closure
*/
public static function getRoutes(): Closure {
return function () {
This file contains hidden or 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
/** | |
* Torc.dev Events brings together developers, makers, and innovators to share tools, experiments, and ideas | |
* at the intersection of technology and creativity. | |
* | |
* This brings events from the torc.dev/community site into a Google folder and a calendar. | |
* | |
* You really care about the cron function at the bottom, and that's it. You can disable the calendar functionality. | |
*/ | |
This file contains hidden or 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
/** | |
* On your resource, you need to override the getEloquentQuery method. Here is the original: | |
**/ | |
public static function getEloquentQuery(): Builder { | |
$query = static::getModel()::query(); | |
if ($tenant = Filament::getTenant()) { | |
static::scopeEloquentQueryToTenant($query, $tenant); | |
} |
This file contains hidden or 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\Rules; | |
use Illuminate\Validation\Rules\Password as Rule; | |
/** | |
* A password rule for Laravel based on Stanford's best practices. | |
* https://uit.stanford.edu/service/accounts/passwords | |
* |
This file contains hidden or 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\Console\Commands; | |
use Illuminate\Console\Command; | |
use DB; | |
/** | |
* In no way is this complete, but should give you a good starting point. | |
**/ |
This file contains hidden or 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
/** | |
* This is a dead simple way to share your current user within all views in a traditional website. | |
* Make sure you are importing Illuminate\Support\Facades\View into your AppServiceProvider, | |
* then add this to the boot method. Once you do that, you can use the $user variable at | |
* any point in the view to get your currently authenticated view. | |
*/ | |
View::share('user', \Auth::user()); |
This file contains hidden or 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
$files = []; | |
foreach ([ | |
app_path('Models/*.php'), | |
app_path('*.php'), | |
] as $path) { | |
$folder = dirname($path); | |
if (!file_exists($folder) || !is_dir($folder)) { | |
continue; | |
} | |
$files = array_merge($files, glob($path)); |
This file contains hidden or 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
This is a very inefficient way to do it once the db is huge. But it works. For the example, the user id is 5. | |
$userId = 5; | |
\DB::statement('SET @row=0'); | |
$user = \App\Models\User::whereRaw('1=1') | |
->select([ | |
\DB::raw('@row:=@row+1 as row'), | |
\DB::raw('count(*) as c'), | |
'users.*' | |
]) |
This file contains hidden or 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\Support\Facades\Hash; | |
/** | |
* Trait HasPasswordAttribute | |
* @package App\Traits | |
*/ |
This file contains hidden or 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 | |
// Customize this. | |
namespace Crumbls\ExtendedData\Traits; | |
use Str; | |
use Illuminate\Support\Facades\Cache; | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Support\Facades\DB; |
NewerOlder