Skip to content

Instantly share code, notes, and snippets.

View Naoray's full-sized avatar
🚀
Exploring new ways

Krishan König Naoray

🚀
Exploring new ways
View GitHub Profile
{
/**
* Silence the noise
*/
"workbench.activityBar.visible": false,
"workbench.statusBar.visible": false,
"workbench.editor.enablePreview": false,
"window.menuBarVisibility": "toggle",
"editor.minimap.enabled": false,
"explorer.autoReveal": false,
@Naoray
Naoray / addon-within-own-namespace.yaml
Last active April 17, 2020 11:54
Ideas on how to add addon's definition to blueprint
models:
Post:
author_id: id:user
# other field definitions
Comment:
post_id: id
addons:
nova:
use Laravel\Nova\Nova;
protected function withoutNovaExceptionHandling(array $except = [])
{
Nova::serving(function ($event) use ($except) {
$this->withoutExceptionHandling($except);
});
return $this;
}
@Naoray
Naoray / mixin.js
Created March 25, 2019 09:09
Using the equivalent of php trait
// taken from http://calebporzio.com/equivalent-of-php-class-traits-in-javascript/
function addMixin(target, ...sources) {
sources.forEach(source => {
let descriptors = Object.keys(source).reduce((descriptors, key) => {
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
return descriptors;
}, {});
Object.getOwnPropertySymbols(source).forEach(sym => {
@Naoray
Naoray / tasks.md
Last active February 26, 2018 09:55
Solutions Commits

Switch between solutions with git checkout commit-sha

  • Task-1 => #09f0a3e7
    • erstelle eine Form in einem todo.blade.php view => #cb48f4e
    • erstelle ein Task - Model => #ee82f7b
    • erstelle eine entsprechende Migration für die Daten des Task-Models => #63c01be
    • erstelle eine Sqlite Datei und richte das verwenden einer sqlite-Datenbank ein => #feb5370
    • erstelle einen TasksController und implementiere die index/store Funktionalität => #537392e
    • Erstelle die routes um... => #c352344
  • den todo vie
@Naoray
Naoray / Project.php
Created January 11, 2018 09:19
Accessor can't be accessed through HasMany Relationship
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Project extends Model
{
public function getFooAttribute()
{
<?php
namespace App\SparkExtensions;
use Illuminate\Support\Facades\Validator;
use Laravel\Spark\Events\Profile\ContactInformationUpdated;
use Laravel\Spark\Interactions\Settings\Profile\UpdateContactInformation as SparkUpdateContactInformation;
class UpdateContactInformation extends SparkUpdateContactInformation
{
<?php
class SparkServiceProvider
{
public function booted()
{
Spark::swap('UpdateContactInformatio@handle', function ($user, array $data) {
$user->forceFill([
'name' => $data['name'],
<?php
class UpdateContactInformation implements Contract
{
/**
* {@inheritdoc}
*/
public function handle($user, array $data)
{
$user->forceFill([
<?php
class ContactInformationController extends Controller
{
//...
/**
* Update the user's contact information settings.
*
* @param Request $request