Skip to content

Commit

Permalink
laravel 11 update
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Apr 24, 2024
1 parent 79d90af commit d9abea9
Show file tree
Hide file tree
Showing 77 changed files with 53,367 additions and 1,793 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [3x1io]
88 changes: 88 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: TomatoPHP CI/CD
on:
pull_request:
branches:
- master
- develop
push:
branches:
- master
- develop
jobs:
laravel:
name: Laravel (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
env:
DB_DATABASE: laravel
DB_USERNAME: root
DB_PASSWORD: password
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: laravel
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['8.2']
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: sqlite, pdo_sqlite, pcntl, zip, intl, exif, mbstring, dom, fileinfo, mysql
coverage: xdebug

- name: Copy .env Before Install Composer
run: php -r "file_exists('.env') || copy('.env.example', '.env'); echo file_get_contents('.env');"

- name: Start MySQL Service
run: sudo /etc/init.d/mysql start

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Generate Applications Key
run: php artisan key:generate

- name: Clear Config
run: php artisan config:clear

- name: Run Migration
run: php artisan migrate -v
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}

- name: Run NPM Install
run: npm install

- name: Run NPM Run Build
run: npm run build
24 changes: 24 additions & 0 deletions .scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e

echo "Deployment started ..."

# Pull the latest version of the app
git reset --hard
git pull origin master

# Install composer dependencies
composer install

# Clear the old cache
php8.2 artisan clear-compiled

# Recreate cache
php8.2 artisan optimize


# Run database migrations
php8.2 artisan migrate --force


echo "Deployment finished!"
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Fady Mondy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Empty file added Modules/.gitkeep
Empty file.
67 changes: 16 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,31 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
![Screenshot](https://github.com/tomatophp/tomato/blob/master/art/screenshot.png)

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
# Tomato Framework

## About Laravel
🍅 TomatoPHP is built to make it easy to develop web apps and API by generating files of CRUD operations and support helpers of tonnes of functions to make it easy to manage and use framework services.

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
## Installation

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
```bash
composer create-project tomatophp/tomato
```

Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Support

## Learning Laravel
you can join our discord server to get support [TomatoPHP](https://discord.gg/Xqmt35Uh)

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
## Docs

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
you can check docs of this package on [Docs](https://docs.tomatophp.com)

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Changelog

## Laravel Sponsors
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
## Credits

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
- [Fady Mondy](https://github.com/3x1io)

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
Empty file added SECURITY.md
Empty file.
28 changes: 16 additions & 12 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Jetstream\HasTeams;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
class User extends Authenticatable
{
use HasFactory, Notifiable;
use HasApiTokens, HasFactory, Notifiable;
use HasTeams;
use HasProfilePhoto;
use TwoFactorAuthenticatable;

/**
* The attributes that are mass assignable.
Expand All @@ -33,15 +40,12 @@ class User extends Authenticatable
];

/**
* Get the attributes that should be cast.
* The attributes that should be cast.
*
* @return array<string, string>
* @var array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
Binary file added art/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/dashboard-dark-rtl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/dashboard-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/dashboard-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/login-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/roles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/slideover-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/table-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/table-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 CRUD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 dashboard dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/v1.2 profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions bin/serve
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

# Fail the whole script if any command fails
set -euo pipefail
trap "echo \"[INFO] To stop the docker container you need to run: bin/stop\"" EXIT

FRESH=false

# Delete old environment for new setup
if [ $# -eq 1 ] && [ $1 == '--fresh' ]
then
rm -rf node_modules
rm -rf vendor
rm -f storage/sail/composer.lock
rm -f storage/sail/package-lock.json
rm -f storage/sail/yarn.lock
rm -f storage/sail/docker-compose.yml
rm -f .env
fi

# Create environment file if it doesn't exist yet
if [ ! -f .env ]
then
sed 's/APP_URL=.*/APP_URL=http:\/\/localhost/g;s/DB_HOST=.*/DB_HOST=mysql/g;s/REDIS_HOST=.*/REDIS_HOST=redis/g;s/MAIL_HOST=.*/MAIL_HOST=mailpit/g' < .env.example > .env
FRESH=true
fi

# Install needed composer dependencies for Laravel Sail
if [ ! -f vendor/bin/sail ]
then
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php82-composer:latest \
composer install --ignore-platform-reqs
fi

# Create/Sync Docker-Containers based on Docker Compose File
if [ ! -f storage/sail/docker-compose.yml ] || ! cmp --silent -- "docker-compose.yml" "storage/sail/docker-compose.yml"
then
FRESH=true

vendor/bin/sail stop
vendor/bin/sail build --no-cache --pull

cp docker-compose.yml storage/sail/docker-compose.yml
fi

# Get Laravel Sail up and running in the background
vendor/bin/sail up -d --wait

# Install node dependencies if not installed yet
if [ ! -d node_modules ]
then

if [ ! -f yarn.lock ]
then
vendor/bin/sail npm install

# Save currently installed dependencies
cp package-lock.json storage/sail/package-lock.json
else
vendor/bin/sail yarn install

# Save currently installed dependencies
cp yarn.lock storage/sail/yarn.lock
fi

fi

# Install latest composer dependencies, if out of sync
if ! cmp --silent -- "composer.lock" "storage/sail/composer.lock"
then
vendor/bin/sail composer install

# Save currently installed dependencies
cp composer.lock storage/sail/composer.lock
fi

# Install latest npm dependencies, if out of sync
if ! cmp --silent -- "package-lock.json" "storage/sail/package-lock.json"
then

if [ ! -f yarn.lock ]
then
vendor/bin/sail npm install

# Save currently installed dependencies
cp package-lock.json storage/sail/package-lock.json
else
vendor/bin/sail yarn install

# Save currently installed dependencies
cp yarn.lock storage/sail/yarn.lock
fi

fi

# Migrate Database to the newest version
if $FRESH
then
vendor/bin/sail artisan migrate:fresh --seed --force
else
vendor/bin/sail artisan migrate --force
fi


# Start the Development Server

if [ ! -f yarn.lock ]
then
vendor/bin/sail npm run dev
else
vendor/bin/sail yarn run dev
fi
7 changes: 7 additions & 0 deletions bin/stop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Fail the whole script if any command fails
set -euo pipefail

# Stop Laravel Sail and the docker containers
vendor/bin/sail stop
Loading

0 comments on commit d9abea9

Please sign in to comment.