--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use Backpack\CRUD\app\Http\Controllers\CrudController;
+
+// VALIDATION: change the requests to match your own file names if you need form validation
+use App\Http\Requests\ProjectRequest as StoreRequest;
+use App\Http\Requests\ProjectRequest as UpdateRequest;
+
+/**
+ * Class ProjectCrudController
+ * @package App\Http\Controllers\Admin
+ * @property-read CrudPanel $crud
+ */
+class ProjectCrudController extends CrudController
+{
+ public function setup()
+ {
+ /*
+ |--------------------------------------------------------------------------
+ | CrudPanel Basic Information
+ |--------------------------------------------------------------------------
+ */
+ $this->crud->setModel('App\Models\Project');
+ $this->crud->setRoute(config('backpack.base.route_prefix') . '/project');
+ $this->crud->setEntityNameStrings('project', 'projects');
+
+ /*
+ |--------------------------------------------------------------------------
+ | CrudPanel Configuration
+ |--------------------------------------------------------------------------
+ */
+
+ // TODO: remove setFromDb() and manually define Fields and Columns
+ $this->crud->setFromDb();
+
+ // add asterisk for fields that are required in ProjectRequest
+ $this->crud->setRequiredFields(StoreRequest::class, 'create');
+ $this->crud->setRequiredFields(UpdateRequest::class, 'edit');
+ }
+
+ public function store(StoreRequest $request)
+ {
+ // your additional operations before save here
+ $redirect_location = parent::storeCrud($request);
+ // your additional operations after save here
+ // use $this->data['entry'] or $this->crud->entry
+ return $redirect_location;
+ }
+
+ public function update(UpdateRequest $request)
+ {
+ // your additional operations before save here
+ $redirect_location = parent::updateCrud($request);
+ // your additional operations after save here
+ // use $this->data['entry'] or $this->crud->entry
+ return $redirect_location;
+ }
+}
--- /dev/null
+<?php
+
+namespace App\Http\Requests;
+
+use App\Http\Requests\Request;
+use Illuminate\Foundation\Http\FormRequest;
+
+class ProjectRequest extends FormRequest
+{
+ /**
+ * Determine if the user is authorized to make this request.
+ *
+ * @return bool
+ */
+ public function authorize()
+ {
+ // only allow updates if the user is logged in
+ return backpack_auth()->check();
+ }
+
+ /**
+ * Get the validation rules that apply to the request.
+ *
+ * @return array
+ */
+ public function rules()
+ {
+ return [
+ // 'name' => 'required|min:5|max:255'
+ ];
+ }
+
+ /**
+ * Get the validation attributes that apply to the request.
+ *
+ * @return array
+ */
+ public function attributes()
+ {
+ return [
+ //
+ ];
+ }
+
+ /**
+ * Get the validation messages that apply to the request.
+ *
+ * @return array
+ */
+ public function messages()
+ {
+ return [
+ //
+ ];
+ }
+}
protected $table = 'users';
+ protected $attributes = ['company' => ''];
+
/**
* Send the password reset notification.
*
--- /dev/null
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+use Backpack\CRUD\CrudTrait;
+
+class Project extends Model
+{
+ use CrudTrait;
+
+ /*
+ |--------------------------------------------------------------------------
+ | GLOBAL VARIABLES
+ |--------------------------------------------------------------------------
+ */
+
+ protected $table = 'projects';
+ // protected $primaryKey = 'id';
+ // public $timestamps = false;
+ // protected $guarded = ['id'];
+ protected $fillable = ['name'];
+ // protected $hidden = [];
+ // protected $dates = [];
+
+ /*
+ |--------------------------------------------------------------------------
+ | FUNCTIONS
+ |--------------------------------------------------------------------------
+ */
+
+ /*
+ |--------------------------------------------------------------------------
+ | RELATIONS
+ |--------------------------------------------------------------------------
+ */
+
+ /*
+ |--------------------------------------------------------------------------
+ | SCOPES
+ |--------------------------------------------------------------------------
+ */
+
+ /*
+ |--------------------------------------------------------------------------
+ | ACCESORS
+ |--------------------------------------------------------------------------
+ */
+
+ /*
+ |--------------------------------------------------------------------------
+ | MUTATORS
+ |--------------------------------------------------------------------------
+ */
+}
namespace App;
+use Backpack\CRUD\CrudTrait;
+use Spatie\Permission\Traits\HasRoles;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
+ use CrudTrait;
+ use HasRoles;
/**
* The attributes that are mass assignable.
* @var array
*/
protected $fillable = [
- 'name', 'email', 'password',
+ 'name', 'email', 'password'
];
/**
"backpack/permissionmanager": "^3.12",
"backpack/settings": "^2.1",
"barryvdh/laravel-elfinder": "^0.4.1",
+ "doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0"
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "73b51212b873899b1e37a1be6c3ea7c5",
+ "content-hash": "04be8215e2d7d144f71d35d8f473a76f",
"packages": [
{
"name": "almasaeed2010/adminlte",
'project_name' => 'Backpack',
// Menu logos
- 'logo_lg' => '<b>Back</b>pack',
- 'logo_mini' => '<b>B</b>p',
+ 'logo_lg' => '<b>Cubedesigners</b>',
+ 'logo_mini' => '<b>C</b>D',
// Developer or company name. Shown in footer.
- 'developer_name' => 'Cristian Tabacitu',
+ 'developer_name' => '',
// Developer website. Link in footer.
'developer_link' => 'http://tabacitu.ro',
// Show powered by Laravel Backpack in the footer?
- 'show_powered_by' => true,
+ 'show_powered_by' => false,
// The AdminLTE skin. Affects menu color and primary/secondary colors used throughout the application.
- 'skin' => 'skin-purple',
+ 'skin' => 'skin-blue',
// Options: skin-black, skin-blue, skin-purple, skin-red, skin-yellow, skin-green, skin-blue-light, skin-black-light, skin-purple-light, skin-green-light, skin-red-light, skin-yellow-light
// Date & Datetime Format Syntax: https://github.com/jenssegers/date#usage
// (same as Carbon)
- 'default_date_format' => 'j F Y',
+ 'default_date_format' => 'j F Y',
'default_datetime_format' => 'j F Y H:i',
// Content of the HTML meta robots tag to prevent indexing and link following
// Overlays - CSS files that change the look and feel of the admin panel
'overlays' => [
'vendor/backpack/base/backpack.bold.css',
- // 'vendor/backpack/base/backpack.content.is.king.css',
+ 'vendor/backpack/base/backpack.content.is.king.css',
],
/*
// Username column for authentication
// The Backpack default is the same as the Laravel default (email)
// If you need to switch to username, you also need to create that column in your db
- 'authentication_column' => 'email',
+ 'authentication_column' => 'email',
'authentication_column_name' => 'Email',
// The guard that protects the Backpack admin panel.
// "ga" => "Irish",
// "it_IT" => "Italian (Italy)",
// "it_CH" => "Italian (Switzerland)",
- 'it' => 'Italian',
+ // 'it' => 'Italian',
// "ja_JP" => "Japanese (Japan)",
// "ja" => "Japanese",
// "kea_CV" => "Kabuverdianu (Cape Verde)",
// "pa" => "Punjabi",
// "ro_MD" => "Romanian (Moldova)",
// "ro_RO" => "Romanian (Romania)",
- 'ro' => 'Romanian',
+ // 'ro' => 'Romanian',
// "rm_CH" => "Romansh (Switzerland)",
// "rm" => "Romansh",
// "rof_TZ" => "Rombo (Tanzania)",
--- /dev/null
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProjectsTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::create('projects', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name');
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('projects');
+ }
+}
--- /dev/null
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddAttributesToProjectsTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('projects', function (Blueprint $table) {
+ $table->unsignedInteger('client');
+ $table->unsignedInteger('manager');
+ $table->unsignedSmallInteger('status');
+ $table->boolean('old')->default(false);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('projects', function (Blueprint $table) {
+ $table->dropColumn(['client', 'manager', 'old', 'status']);
+ });
+ }
+}
--- /dev/null
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTasksTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::create('tasks', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name');
+ $table->unsignedSmallInteger('category');
+ $table->unsignedSmallInteger('type');
+ $table->float('price');
+ $table->float('price_per_day');
+ $table->unsignedInteger('project');
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('tasks');
+ }
+}
--- /dev/null
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateCompaniesTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::create('companies', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name');
+ $table->multiLineString('address');
+ $table->string('zipcode', 16);
+ $table->string('city');
+ $table->string('country', 2);
+ $table->string('vat_number', 64);
+ $table->unsignedSmallInteger('type');
+ $table->longText('notes');
+
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('companies');
+ }
+}
<!-- This file is used to store sidebar items, starting with Backpack\Base 0.9.0 -->
<li><a href="{{ backpack_url('dashboard') }}"><i class="fa fa-dashboard"></i> <span>{{ trans('backpack::base.dashboard') }}</span></a></li>
-<li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i> <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>
\ No newline at end of file
+<li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i> <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>
+<!-- Users, Roles Permissions -->
+<li class="treeview">
+ <a href="#"><i class="fa fa-group"></i> <span>Users, Roles, Permissions</span> <i class="fa fa-angle-left pull-right"></i></a>
+ <ul class="treeview-menu">
+ <li><a href="{{ backpack_url('user') }}"><i class="fa fa-user"></i> <span>Users</span></a></li>
+ <li><a href="{{ backpack_url('role') }}"><i class="fa fa-group"></i> <span>Roles</span></a></li>
+ <li><a href="{{ backpack_url('permission') }}"><i class="fa fa-key"></i> <span>Permissions</span></a></li>
+ </ul>
+</li>
+
+<li><a href='{{ backpack_url('project') }}'><i class='fa fa-rocket'></i> <span>Projects</span></a></li>
\ No newline at end of file
'middleware' => ['web', config('backpack.base.middleware_key', 'admin')],
'namespace' => 'App\Http\Controllers\Admin',
], function () { // custom admin routes
-}); // this should be the absolute last line of this file
+ CRUD::resource('project', 'ProjectCrudController');
+}); // this should be the absolute last line of this file
\ No newline at end of file