Skip to content

Instantly share code, notes, and snippets.

View allanphilipbarku's full-sized avatar

Allan Philip Barku allanphilipbarku

View GitHub Profile
<?php
use Valet\Drivers\LaravelValetDriver;
class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool

how to prevent delete record when have a child record ?

DeleteAction::make()->hidden(fn ($record) => $record->childRelationship()->exists())
@allanphilipbarku
allanphilipbarku / regions-districts-ghana.csv
Last active October 14, 2023 08:56
List of regions with their districts of Ghana in a csv formart
region distric_name
Ashanti Region Adansi Asokwa
Ashanti Region Adansi North
Ashanti Region Adansi South
Ashanti Region Afigya Kwabre North
Ashanti Region Afigya Kwabre South
Ashanti Region Ahafo Ano North Municipal
Ashanti Region Ahafo Ano South East
Ashanti Region Ahafo Ano South West
Ashanti Region Akrofuom
@allanphilipbarku
allanphilipbarku / regions-ghana.csv
Last active July 15, 2022 10:12
List of regions of Ghana in csv formart
name
Ashanti Region
Bono Region
Bono East Region
Ahafo Region
Central Region
East Region
Greater Accra Region
Northern Region
Savannah Region
@allanphilipbarku
allanphilipbarku / year_validation.php
Last active May 25, 2021 06:41
Laravel Year Validation
<?php
$this->validate(
$request,[
'year' => 'integer|required|digits:4|min:1900|max:' . (date('Y') - 1),
]
);
?>
@allanphilipbarku
allanphilipbarku / apache2_vhost_config_vuejs_dist
Last active June 30, 2020 16:15 — forked from 7rin0/apache2_vhost_config_vuejs_dist
VueJS: Apache with forced https and http2 / Nginx vhost config examples
<VirtualHost *:80>
Protocols h2 h2c http/1.1
ServerName vuejs.project-url.com
ServerAdmin webmaster@vuejs.project-url.com
DocumentRoot /var/www/html/projec-root-directory/dist/
<Directory "/var/www/html/projec-root-directory/dist/">
AllowOverride All
Options FollowSymLinks Multiviews Indexes
Require all granted
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
const functionC = ()=>{/*send log*/}
return new Map([
[/^guest_[1-4]$/,functionA],
[/^guest_5$/,functionB],
[/^guest_.*$/,functionC],
//...
])
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
return new Map([
[/^guest_[1-4]$/,functionA],
[/^guest_5$/,functionB],
//...
])
}
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
return new Map([
[{identity:'guest',status:1},functionA],
[{identity:'guest',status:2},functionA],
[{identity:'guest',status:3},functionA],
[{identity:'guest',status:4},functionA],
[{identity:'guest',status:5},functionB],
//...