Skip to content

Instantly share code, notes, and snippets.

<?php
namespace App\Core\Concerns;
trait AuthorizesVue
{
/**
* Accessor for can attribute.
*/
public function getCanAttribute()
blatantly.Icky.Choral8.9poole.Adjust.1colonize
+--------+-----------+------------------------------------------------------------------+----------------------------------------+---------------------------------------------------------------------+-----------------------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+------------------------------------------------------------------+----------------------------------------+---------------------------------------------------------------------+-----------------------------+
| | GET|HEAD | / | pages.dashboard | App\Http\Controllers\PagesController@dashboard | web,auth |
| | GET|HEAD | _dusk/login/{userId}/{guard?} |
+--------+-----------+------------------------------------------------------------------+----------------------------------------+---------------------------------------------------------------------+-----------------------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+------------------------------------------------------------------+----------------------------------------+---------------------------------------------------------------------+-----------------------------+
| | GET|HEAD | / | pages.dashboard | App\Http\Controllers\PagesController@dashboard | web,auth |
| | GET|HEAD | _dusk/login/{userId}/{guard?} |
// I just do a replace to transform something like users.events.inddex in UsersEventsIndex
ViewFactory::macro('component', function ($name, $data = []) {
$name = str_replace(' ', '', ucwords(str_replace('.', ' ', $name)));
return View::make('app', ['name' => $name, 'data' => $data]);
});
// In the app.js tiny little modifications to calculate the componentName
@jobcerto
jobcerto / restore-items-from-parent-or-child.php
Last active August 17, 2018 05:44
Restore records from child or parent
// FILTRA O USUÁRIO
$userToDelete = User::first();
//REMOVE OS PRODUTOS
$userToDelete->products()->delete();
//REMOVE O USUÁRIO
$userToDelete->delete();
//FILTRA O USUARIO DA LIXEIRA
$userToRestore = User::withTrashed()->first();
<?php
namespace App\System\Models;
use App\Shared\Models\User as Shared;
use Hyn\Tenancy\Traits\UsesSystemConnection;
class User extends Shared
{
use UsesSystemConnection;
<?php
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});