This commit is contained in:
Thibault Richy 2019-01-15 14:17:15 +01:00
commit 8a1054333a
246 changed files with 45525 additions and 0 deletions

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_size = 2

39
.env.example Normal file
View file

@ -0,0 +1,39 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

5
.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore

14
.gitignore vendored Normal file
View file

@ -0,0 +1,14 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
.phpunit.result.cache

42
app/Calendrier.php Normal file
View file

@ -0,0 +1,42 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Calendrier extends Model
{
/**
* @var string
*/
protected $table = 'calendrier';
/**
* @var bool
*/
public $timestamps = false;
/**
* @var string
*/
protected $primaryKey = 'calendrier_id';
protected $dates = ['calendrier_startdate', 'calendrier_enddate'];
/**
* @var array
*/
protected $fillable = [
'calendrier_startdate',
'calendrier_enddate'
];
/**
* ManyToOne
* Calendrier -> Coupon
*/
public function coupon()
{
return $this->belongsTo('App\Coupon', 'calendrier_couponId');
}
}

99
app/Campagne.php Normal file
View file

@ -0,0 +1,99 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Campagne extends Model
{
use SoftDeletes;
/**
* @var string
*/
const CREATED_AT = 'camp_createdate';
/**
* @var string
*/
const UPDATED_AT = 'camp_updatedate';
/**
* @var string
*/
const DELETED_AT = 'camp_deleted_at';
/**
* @var string
*/
protected $table = 'campagne';
/**
* @var string
*/
protected $primaryKey = 'camp_id';
/**
* @var array
*/
protected $dates = ['camp_deleted_at'];
/**
* OneToMany
* Campagne -> Notification
*/
public function notifications()
{
return $this->hasMany('App\Notification', 'notif_campId', 'camp_id');
}
/**
* OneToMany
* Campagne -> Mur
*/
public function murs()
{
return $this->hasMany('App\Mur', 'mur_campId', 'camp_id');
}
/**
* OneToMany
* Campagne -> Panier
*/
public function paniers()
{
return $this->hasMany('App\Panier', 'panier_campId', 'camp_id');
}
/**
* ManyToOne
* Campagne -> Site
*/
public function site()
{
return $this->belongsTo('App\Site', 'camp_siteId');
}
/**
* The coupons that belong to the campagne.
*/
public function coupons()
{
return $this->belongsToMany('App\Coupon', 'campagne_coupon', 'campagne_id', 'coup_id');
}
/**
* @var array
*/
protected $fillable = [
'camp_siteId',
'camp_name',
'camp_type',
'camp_limitedPrinting',
'camp_published'
];
}

42
app/Console/Kernel.php Normal file
View file

@ -0,0 +1,42 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

92
app/Contact.php Normal file
View file

@ -0,0 +1,92 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model
{
/**
* @var string
*/
const CREATED_AT = 'contact_createdate';
/**
* @var string
*/
const UPDATED_AT = 'contact_updatedate';
/**
* @var string
*/
protected $table = 'contact';
/**
* @var string
*/
protected $primaryKey = 'contact_id';
/**
* @var array
*/
protected $fillable = [
'contact_ref',
'contact_prenom',
'contact_nom',
'contact_email',
'contact_cp',
'contact_ville',
'contact_country',
];
/**
* OneToMany
* Contact -> Mur
*/
public function murs()
{
return $this->hasMany('App\Mur', 'mur_contactId', 'contact_id');
}
/**
* OneToMany
* Contact -> Panier
*/
public function paniers()
{
return $this->hasMany('App\Panier', 'panier_contactId', 'contact_id');
}
/**
* ManyToOne
* Contact -> Site
*/
public function site()
{
return $this->belongsTo('App\Site', 'contact_siteId');
}
public function scopeSearchName($query, $name) {
if ($name) $query->where('contact_nom', $name);
}
public function scopeSearchFirstname($query, $firstname) {
if ($firstname) $query->where('contact_prenom', $firstname);
}
public function scopeSearchEmail($query, $email) {
if ($email) $query->where('contact_email', $email);
}
public function scopeSearchVille($query, $ville) {
if ($ville) $query->where('contact_ville', $ville);
}
public function scopeSearchCp($query, $cp) {
if ($cp) $query->where('contact_cp', $cp);
}
public function scopeSearchCountry($query, $country) {
if ($country) $query->where('contact_country', $country);
}
}

108
app/Coupon.php Normal file
View file

@ -0,0 +1,108 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Coupon extends Model
{
/**
* @var string
*/
const CREATED_AT = 'coupon_createdate';
/**
* @var string
*/
const UPDATED_AT = 'coupon_updatedate';
/**
* @var string
*/
protected $table = 'coupon';
/**
* @var string
*/
protected $primaryKey = 'coupon_id';
/**
* OneToMany
* Coupon -> Calendrier
*/
public function calendriers()
{
return $this->hasMany('App\Calendrier', 'calendrier_couponId', 'coupon_id');
}
/**
* OneToMany
* Coupon -> PanierContent
*/
public function panierContents()
{
return $this->hasMany('App\PanierContent', 'panier_content_couponId', 'coupon_id');
}
/**
* OneToMany
* Coupon -> Mur
*/
public function murs()
{
return $this->hasMany('App\Mur', 'mur_couponId', 'coupon_id');
}
/**
* OneToMany
* Coupon -> Mouvement
*/
public function mouvements()
{
return $this->hasMany('App\Mouvement', 'mouvement_couponId', 'coupon_id');
}
/**
* ManyToOne
* Coupon -> Site
*/
public function site()
{
return $this->belongsTo('App\Site', 'coupon_siteId');
}
/**
* The campagnes that belong to the coupon.
*/
public function campagnes()
{
return $this->belongsToMany('App\Campagne', 'campagne_coupon', 'coup_id', 'campagne_id');
}
/**
* @var array
*/
protected $fillable = [
'coupon_code',
'coupon_norme',
'coupon_gs1code',
'coupon_name',
'coupon_value',
'coupon_enablelimitquantity',
'coupon_limitquantity',
'coupon_enablelimitperiod',
'coupon_limitperiod',
'coupon_validity',
'coupon_maxdatediffusion',
'coupon_maxdatevalidity',
'coupon_thumbnail1',
'coupon_thumbnail2',
'coupon_thumbnail3',
'coupon_thumbnail4',
'coupon_image',
'coupon_published',
'coupon_products_image',
'coupon_validity_text',
'coupon_legal_mentions'
];
}

View file

@ -0,0 +1,51 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use App\Campagne;
use App\Coupon;
use Illuminate\Http\Request;
class AjaxController extends Controller
{
public function add_coupons_ajax(Request $request){
$camp_id = $request->input('campid');
$campagne = Campagne::where('camp_id', $camp_id)->first();
$ids = $request->input('ids');
$coupons = Coupon::find($ids);
$campagne->coupons()->attach($coupons);
return json_encode($coupons);
}
public function remove_coupons_ajax(Request $request){
$camp_id = $request->input('campid');
$campagne = Campagne::where('camp_id', $camp_id)->first();
$coupon_id = $request->input('couponid');
$coupon = Coupon::find($coupon_id);
$campagne->coupons()->detach($coupon_id);
return json_encode($coupon);
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

View file

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View file

@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}

View file

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View file

@ -0,0 +1,162 @@
<?php
namespace App\Http\Controllers;
use App\Campagne;
use App\Site;
use App\Coupon;
use App\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class CampagneController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$campagnes = Campagne::where('camp_siteId', session()->get('site')->site_id)->get();
return view('campagne.index')->with('campagnes', $campagnes);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('campagne.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$campagne = new Campagne();
$campagne->camp_name = $request->input('camp_name');
$campagne->camp_type = $request->input('camp_type');
$campagne->camp_published = $request->input('camp_published');
if (null !== $request->input('camp_limitedPrinting')) {
$campagne->camp_limitedPrinting = $request->input('camp_limitedPrinting');
}
$site = Site::findOrFail(session()->get('site')->id)->first();
if ($site->campagnes()->save($campagne)) {
$campId = str_pad(strval($campagne->camp_id), 5, '00000', STR_PAD_LEFT);
Storage::makeDirectory('/landings/' . $campId);
}
return redirect(route('campagne.edit', ['campagne' => $campagne]));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function edit(Campagne $campagne)
{
$site = Site::findOrFail(session()->get('site')->id)->first();
$couponsLinked = $campagne->coupons()->get();
$campid = $campagne->camp_id;
$couponsNotLinked = Coupon::whereDoesntHave('campagnes', function($q) use ($campid){
$q->where('campagne_id', $campid);
})->where('coupon_siteId', session()->get('site')->id)->get();
return view('campagne.edit', ['campagne' => $campagne, 'coupons' => $couponsNotLinked, 'couponsLinked' => $couponsLinked]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Campagne $campagne)
{
if ($campagne->update($request->all())) {
session()->flash('update_ok', 'La campagne a bien été modifiée');
} else {
session()->flash('update_nok', 'Erreur lors de l\'enregistrement');
}
return view('campagne.edit')->with('campagne', $campagne);
}
/**
* Remove the specified resource from storage.
*
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function destroy(Campagne $campagne)
{
if ($campagne->delete()) {
return redirect(route('campagne.index'));
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return view('campagne.edit')->with('campagne', $campagne);
}
}
/**
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function saveNotification(Request $request)
{
$notification = new Notification();
$notification->notif_email = $request->input('notif_email');
$notification->notif_campId = $request->input('notif_campId');
$notification->save();
return redirect()->back();
}
/**
* @param \App\Notification $notification
*
* @return array
*/
public function deleteNotification($id)
{
$notification = Notification::find($id);
if ($notification->delete()) {
return redirect()->back();
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return redirect()->back();
}
}
/**
* @param \App\Coupon $coupon
*
* @return array
*/
public function deleteCoupon($id)
{
$coupon = Coupon::find($id);
if ($notification->delete()) {
return redirect()->back();
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return redirect()->back();
}
}
}

View file

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ChangeMarqueController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$siteId = $request->input('site_id');
$currentRoute = $request->input('current_route');
$site = \App\Site::findOrFail($siteId);
session()->put('site', $site);
return redirect('/bo/'.$currentRoute);
}
}

View file

@ -0,0 +1,243 @@
<?php
namespace App\Http\Controllers;
use App\Contact;
use App\Site;
use Response;
use Illuminate\Http\Request;
class ContactController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)->orderBy('contact_createdate', 'DESC')->take(10)->get();
return view('contact.index')->with('contacts', $contacts)->with('search', false);
}
public function search_contact(Request $request)
{
session()->put('active_route', 'contact');
$page = $request->input('page');
$name = $request->input('searchName');
$firstname = $request->input('searchFirstname');
$email = $request->input('searchEmail');
$cp = $request->input('searchCp');
$ville = $request->input('searchVille');
$country = $request->input('searchCountry');
if(isset($name) || isset($firstname) || isset($email) || isset($cp) || isset($ville) || isset($country)){
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)
->searchFirstname($firstname)
->searchName($name)
->searchEmail($email)
->searchCp($cp)
->searchVille($ville)
->searchCountry($country)
->paginate(2,['*'],'page',$page);
return view('contact.index')->with('contacts', $contacts)->with('search', true);
} else {
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)->orderBy('contact_createdate', 'DESC')->take(10)->get();
return view('contact.index')->with('contacts', $contacts)->with('search', false);
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('contact.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$contact = new Contact();
$contact->contact_nom = $request->input('contact_nom');
$contact->contact_prenom = $request->input('contact_prenom');
$contact->contact_ref = $request->input('contact_ref');
$contact->contact_email = $request->input('contact_email');
$contact->contact_cp = $request->input('contact_cp');
$contact->contact_ville = $request->input('contact_ville');
$contact->contact_country = $request->input('contact_country');
$site = Site::findOrFail(session()->get('site')->id)->first();
$contact->contact_siteId = $site->site_id;
$contact->save();
$contacts = Contact::where('contact_siteId', session()->get('site')->site_id)->orderBy('contact_createdate', 'DESC')->take(10)->get();
return view('contact.edit', ['contact' => $contact, 'created' => true, 'contacts' => $contacts]);
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Campagne $campagne
* @return \Illuminate\Http\Response
*/
public function edit(Contact $contact)
{
return view('contact.edit', ['contact' => $contact]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Contact $contact
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Contact $contact)
{
if ($contact->update($request->all())) {
session()->flash('update_ok', 'La campagne a bien été modifiée');
} else {
session()->flash('update_nok', 'Erreur lors de l\'enregistrement');
}
return view('contact.edit')->with('contact', $contact);
}
public function updateContact(Request $request)
{
app('debugbar')->disable();
$error = false;
// ---- Contrôle des paramètres
if(isset($request->refadherent) && $request->refadherent != ""){
$refadherent = $request->refadherent;
}else{
$error = true;
}
if(isset($request->nom) && $request->nom != ""){
$nom = $request->nom;
}else{
$error = true;
}
if(isset($request->refsite) && $request->refsite != ""){
$refsite = $request->refsite;
}else{
$error = true;
}
if(isset($request->prenom) && $request->prenom != ""){
$prenom = $request->prenom;
}else{
$error = true;
}
if(isset($request->email) && $request->email != ""){
$email = $request->email;
}else{
$error = true;
}
if(isset($request->code_postal) && $request->code_postal != ""){
$code_postal = $request->code_postal;
}else{
$error = true;
}
if(isset($request->commune) && $request->commune != ""){
$commune = $request->commune;
}else{
$error = true;
}
if(isset($request->pays) && $request->pays != ""){
$pays = $request->pays;
}else{
$pays = 250;
}
if($error){
return Response::json([
'Statut' => 'KO',
'Code' => 101,
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
$contact = Contact::where(['contact_siteId' => $refsite, 'contact_ref' => $refadherent])->first();
if($contact){
$contact->contact_prenom = $prenom;
$contact->contact_nom = $nom;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_updatedate = date('Y-m-d H:i:s');
} else {
$site = Site::where('site_id', $refsite)->first();
if($site){
$contact = new Contact();
$contact->contact_nom = $nom;
$contact->contact_prenom = $prenom;
$contact->contact_ref = $refadherent;
$contact->contact_email = $email;
$contact->contact_cp = $code_postal;
$contact->contact_ville = $commune;
$contact->contact_country = $pays;
$contact->contact_siteId = $refsite;
} else {
return Response::json([
'Statut' => 'KO',
'Code' => 102,
'Message' => 'Le site spécifié n\'existe pas'
]);
}
}
if ($contact->save()) {
return Response::json([
'Statut' => 'OK',
'contact' => $contact
]);
} else {
return Response::json([
'Statut' => 'KO',
'Code' => 109,
'Message' => 'Une erreur est survenue'
]);
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\Contact $contact
* @return \Illuminate\Http\Response
*/
public function destroy(Contact $contact)
{
if ($contact->delete()) {
return redirect(route('contact.index'));
} else {
session()->flash('delete_nok', 'Erreur lors de la suppression');
return view('contact.edit')->with('contact', $contact);
}
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View file

@ -0,0 +1,226 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use App\Coupon;
use App\Site;
use App\Campagne;
use App\Mouvement;
use App\Calendrier;
class CouponController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$campIds = Campagne::where('camp_siteId', session()->get('site')->site_id)
->get()
->pluck('camp_id')
->flatten()
->toArray();
$coupons = Coupon::where('coupon_siteId', session()->get('site')->id)->get();
foreach ($coupons as $coupon) {
$mouvements = $coupon->mouvements()->get();
$nombre = array();
foreach ($mouvements as $mouvement) {
array_push($nombre, $mouvement->mouvement_nombre);
}
$coupon->coupon_quantity = array_sum($nombre);
}
return view('coupon.index', ['coupons' => $coupons, 'camps' => $campIds]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$campagnes = Campagne::where('camp_siteId', session()->get('site')->site_id)->get()
->pluck('camp_name', 'camp_id');
return view('coupon.create')->with('campagnes', $campagnes);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$datas = $this->saveImg($request);
\Debugbar::info($datas);
$coupon = new Coupon();
$coupon->coupon_code = $datas['coupon_code'];
$coupon->coupon_name = $datas['coupon_name'];
$coupon->coupon_value = $datas['coupon_value'];
if (isset($datas['coupon_thumbnail1'])) {
$coupon->coupon_thumbnail1 = $datas['coupon_thumbnail1'];
}
if (isset($datas['coupon_thumbnail2'])) {
$coupon->coupon_thumbnail2 = $datas['coupon_thumbnail2'];
}
if (isset($datas['coupon_thumbnail3'])) {
$coupon->coupon_thumbnail3 = $datas['coupon_thumbnail3'];
}
if (isset($datas['coupon_thumbnail4'])) {
$coupon->coupon_thumbnail4 = $datas['coupon_thumbnail4'];
}
if (isset($datas['coupon_image'])) {
$coupon->coupon_image = $datas['coupon_image'];
}
if (isset($datas['coupon_norme'])) {
$coupon->coupon_norme = $datas['coupon_norme'];
$coupon->coupon_gs1code = $datas['coupon_gs1code'];
}
if (isset($datas['coupon_enablelimitquantity'])) {
$coupon->coupon_enablelimitquantity = $datas['coupon_enablelimitquantity'];
$coupon->coupon_limitquantity = $datas['coupon_limitquantity'];
}
if (isset($datas['coupon_enablelimitperiod'])) {
$coupon->coupon_enablelimitperiod = $datas['coupon_enablelimitperiod'];
$coupon->coupon_limitperiod = $datas['coupon_limitperiod'];
}
$coupon->coupon_validity = $datas['coupon_validity'];
$coupon->coupon_maxdatediffusion = $datas['coupon_maxdatediffusion'];
$coupon->coupon_maxdatevalidity = $datas['coupon_maxdatevalidity'];
$coupon->coupon_validity_text = $datas['coupon_validity_text'];
$coupon->coupon_legal_mentions = $datas['coupon_legal_mentions'];
if (isset($datas['coupon_products_image'])) {
$coupon->coupon_products_image = $datas['coupon_products_image'];
}
$site = Site::find($request->input('site_id'));
$site->coupons()->save($coupon);
if (isset($datas['initial_quantity'])) {
$coupon->mouvements()->save($datas['initial_quantity']);
}
if(isset($datas['mouvementNbre'])){
foreach($datas['mouvementNbre'] as $key => $value){
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $value;
$mouvement->mouvement_created_at = $datas['mouvementDate'][$key];
$coupon->mouvements()->save($mouvement);
}
}
foreach($datas['startdate'] as $key => $value){
$calendar = new Calendrier();
$calendar->calendrier_startdate = $value;
$calendar->calendrier_enddate = $datas['enddate'][$key];
$coupon->calendriers()->save($calendar);
}
return view('coupon.edit', ['coupon' => $coupon]);
}
/**
* Display the specified resource.
*
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function show(Coupon $coupon)
{
return view('coupon.show', ['coupon' => $coupon]);
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function edit(Coupon $coupon)
{
return view('coupon.edit', ['coupon' => $coupon]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Coupon $coupon)
{
if ($coupon->update($this->saveImg($request))) {
$datas = $this->saveImg($request);
if(isset($datas['mouvementNbre'])){
foreach($datas['mouvementNbre'] as $key => $value){
$mouvement = new Mouvement();
$mouvement->mouvement_nombre = $value;
$mouvement->mouvement_created_at = $datas['mouvementDate'][$key];
$coupon->mouvements()->save($mouvement);
}
}
session()->flash('update_ok', 'Mise à jour du coupon réussie !');
return view('coupon.edit', ['coupon' => $coupon]);
} else {
return view('holder');
}
return view('coupon.edit', ['coupon' => $coupon]);
}
/**
* Remove the specified resource from storage.
*
* @param \App\Coupon $coupon
* @return \Illuminate\Http\Response
*/
public function destroy(Coupon $coupon)
{
//
}
/**
* @param \Illuminate\Http\Request $request
*
* @return array
*/
private function saveImg(Request $request)
{
$datas = collect($request->all());
$imgs = collect(array());
foreach ($datas as $key => $item) {
if ($key == 'coupon_image' || $key == 'coupon_gs1code' || $key == 'coupon_products_image' || (substr($key, 7, 9) == 'thumbnail' && strlen($key) < 18)) {
if (isset($item)) {
$path = $item->store('coupons');
$path = str_replace('public/', '', $path);
$datas->put($key, $path);
} else {
$datas->put($key, $request->input($key . '_hidden'));
}
}
}
return $datas->toArray();
}
}

View file

@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Campagne;
use Barryvdh\Debugbar\Facade as Debugbar;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$test = Campagne::find(102);
Debugbar::info($test);
return view('home')->with([
'test' => $test,
]);
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use App\Mouvement;
use App\Coupon;
use Illuminate\Http\Request;
class MouvementController extends Controller
{
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$mouvement = new Mouvement();
$mouvement->mouvement_type = $request->input('mouvement_type');
$mouvement->mouvement_nombre = $request->input('mouvement_nombre');
$mouvement->mouvement_commentaire = $request->input('mouvement_commentaire');
$coupon = Coupon::find($request->input('coupon_id'));
$coupon->mouvements()->save($mouvement);
}
}

View file

@ -0,0 +1,248 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Campagne;
use app\Coupon;
use App\Contact;
use App\Mur;
use Response;
class MurController extends Controller
{
public function show(Request $request)
{
$datas = $request->all();
$ref = $datas['refcamp'];
$campagne = Campagne::find(intval($ref));
$contact = Contact::where([
'contact_email' => $datas['email'], 'contact_siteId' => $campagne->site->site_id
])->first();
session()->put('campagne', $campagne);
session()->put('site', $campagne->site);
session()->put('contact', $contact);
$view = view('landings::' . $ref . '.index')
->with(['ref'=> $ref, 'coupons' => $campagne->coupons]);
echo($view);
}
public function deleteControlContact(Request $request)
{
$error = false;
// ---- Contrôle des paramètres
if(isset($request->refcamp) && $request->refcamp != ""){
$refcamp = $request->refcamp;
}else{
$error = true;
}
if(isset($request->refadherent) && $request->refadherent != ""){
$refadherent = $request->refadherent;
}else{
$error = true;
}
// Erreur si paramètres mal renseignés
if($error){
return Response::json([
'Statut' => 'KO',
'Code' => 101,
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
//Check du contact
$contact = Contact::where(['contact_ref' => $refadherent])->first();
if(!$contact){
return Response::json([
'Statut' => 'KO',
'Code' => 104,
'Message' => 'Le contact n\'existe pas'
]);
}
//Check de la campagne
$campagne = Campagne::where('camp_id', $refcamp)->first();
if($campagne){
//Update
$mur = Mur::where('mur_campId', $refcamp)->update(['mur_deleted' => '1']);
return Response::json([
'Statut' => 'OK',
'Message' => $mur." enregistrements ont été mis à jour."
]);
} else {
return Response::json([
'Statut' => 'KO',
'Code' => 103,
'Message' => 'La campagne n\'existe pas'
]);
}
return;
}
public function montantDispoCampagne(Request $request)
{
// ---- Contrôle des paramètres
if(isset($request->refcamp) && $request->refcamp != ""){
$refcamp = $request->refcamp;
}else{
return Response::json([
'Statut' => 'KO',
'Code' => 101,
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
// ------ Recuperation de la campagne
$camp = Campagne::where(['camp_id' => $refcamp])->first();
if(!$camp){
return Response::json([
'Statut' => 'KO',
'Code' => 103,
'Message' => 'La campagne n\'existe pas'
]);
}
// ------ Récupération des coupons de la campagne
$coupons = $camp->coupons()->where(['coupon_published' => 1])->get();
if(count($coupons) == 0){
return Response::json([
'Statut' => 'KO',
'Code' => 105,
'Message' => 'La campagne est vide'
]);
}
// ---- Montant total et Nombre réductions disponible
$montantTotal = 0;
foreach($coupons as $coupon){
$montantTotal += $coupon->coupon_value;
}
$montantTotal = number_format($montantTotal, 2, ",", " ");
$montantTotal = str_pad($montantTotal, 6, "0", STR_PAD_LEFT);
return Response::json([
'Statut' => 'OK',
'Message' => $montantTotal
]);
}
public function montantDispoContact(Request $request)
{
$error = false;
if(isset($request->refcamp) && $request->refcamp != ""){
$refcamp = $request->refcamp;
}else{
$error = true;
}
if(isset($request->refsite) && $request->refsite != ""){
$refsite = $request->refsite;
}else{
$error = true;
}
if(isset($request->refadherent) && $request->refadherent != ""){
$refadherent = $request->refadherent;
}else{
$error = true;
}
if ($error) {
return Response::json([
'Statut' => 'KO',
'Code' => 101,
'Message' => 'Des paramètres de la requête sont mal renseignés ou non présents'
]);
}
$campagne = Campagne::where(['camp_id' => $refcamp])->where('camp_type', 'IN', array(0,2))->first();
if (!$campagne) {
return Response::json([
'Statut' => 'KO',
'Code' => 103,
'Message' => 'La campagne n\'existe pas'
]);
}
$contact = Contact::where(['contact_siteId' => $refsite, 'contact_ref' => $refadherent])->first();
if (!$contact) {
return Response::json([
'Statut' => 'KO',
'Code' => 104,
'Message' => 'Le contact n\'existe pas'
]);
}
$coupons = Coupon::where(['coupon_campId' => $refcamp, 'coupon_published' => 1])->get();
foreach($coupons as &$coupon){
$available = true;
// ---- Contrôle le nombre limite d'impression
if($coupon->coupon_enablelimitquantity == 1){
$stat = Mur::where([
'mur_campId' => $campagne->camp_id,
'mur_contactId' => $contact->contact_id,
'mur_couponId' => $coupons->coupon_id,
'mur_deleted' => 0 ])
->count();
if($stat >= $coupon->coupon_limitquantity){
$available = false;
}
}
// ---- Contrôle la limite de période de diffusion
if($coupon->coupon_enablelimitperiod == 1 && $coupon->coupon_limitperiod > 0){
$stat = Mur::where([
'mur_campId' => $campagne->camp_id,
'mur_contactId' => $contact->contact_id,
'mur_couponId' => $coupons->coupon_id,
'mur_deleted' => 0 ])
->orderBy('mur_createdate', 'DESC')
->first();
if ($stat->count > 0){
$dateDisponibilite = date('Y-m-d',strtotime($stat->mur_createdate." +".$coupon->coupon_limitperiod." days"));
if($dateDisponibilite > date('Y-m-d')){
$available = false;
}
}
}
// ---- Contrôle la date de validité
if($coupon->coupon_maxdatevalidity != null){
if(date('Y-m-d') > $coupon->coupon_maxdatevalidity){
$available = false;
}
}
$coupon->isAvailable = $available;
}
unset($coupon);
$montantDispo = 0;
foreach($coupons as $coupon){
if($coupon->isAvailable == true){
$montantDispo += $coupon->coupon_value;
}
}
$montantDispo = number_format($montantDispo, 2, ",", " ");
$montantDispo = str_pad($montantDispo, 6, "0", STR_PAD_LEFT);
return Response::json([
'Statut' => 'OK',
'Message' => $montantDispo
]);
}
}

View file

@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Panier;
class PanierController extends Controller
{
public function showTemplate(Request $request)
{
$panier = Panier::find($request->query('baskedid'));
session()->put('panier', $panier);
var_dump($request->all());
return;
}
public function createBasket(Request $request)
{
var_dump($request->all());
return;
}
public function updateBasket(Request $request)
{
var_dump($request->all());
return;
}
public function showBasket(Request $request)
{
var_dump($request->all());
return;
}
}

View file

@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use App\Site;
use App\Notification;
use Illuminate\Http\Request;
class SiteController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$sites = Site::all();
return view('site.index')->with('sites', $sites);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('site.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$site = new Site();
$datas = $this->saveImg($request);
$site->site_id = $datas['site_id'];
$site->site_nom = $datas['site_nom'];
$site->site_contact = $datas['site_contact'];
$site->site_logo = $datas['site_logo'];
$site->site_rcs = $datas['site_rcs'];
$site->site_libelle = $datas['site_libelle'];
$site->save();
return view('site.edit', ['site' => $site]);
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Site $site
* @return \Illuminate\Http\Response
*/
public function edit(Site $site)
{
return view('site.edit')->with('site', $site);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Site $site
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Site $site)
{
if ($site->update($this->saveImg($request))) {
session()->flash('update_ok', 'Le site a bien été modifié');
} else {
session()->flash('update_nok', 'Erreur lors de l\'enregistrement');
}
return view('site.edit')->with('site', $site);
}
/**
* @param \Illuminate\Http\Request $request
*
* @return array
*/
private function saveImg(Request $request)
{
$datas = collect($request->all());
// Enregistrer le fichiersi il a changé
if ($request->site_logo) {
$path = $request->site_logo->store('images/logos');
$path = str_replace('public/', '', $path);
$datas->put('site_logo', $path);
} else {
$datas->put('site_logo', $request->input('site_logo_hidden'));
}
return $datas->toArray();
}
}

85
app/Http/Kernel.php Normal file
View file

@ -0,0 +1,85 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'process.url' => \App\Http\Middleware\ProcessSpecificUrl::class,
'saveroute' => \App\Http\Middleware\SaveCurrentRoute::class,
'superadmin' => \App\Http\Middleware\SuperAdmin::class,
'admin' => \App\Http\Middleware\Admin::class,
'marketing' => \App\Http\Middleware\Marketing::class,
];
/**
* The priority-sorted list of middleware.
*
* This forces the listed middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
class Admin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Auth::check() && Auth::user()->roles == 'admin') {
return $next($request);
}
elseif (Auth::check() && Auth::user()->roles == 'superadmin') {
return $next($request);
}
else {
return redirect('/bo/home');
}
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
*/
protected function redirectTo($request)
{
return route('login');
}
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
class CheckForMaintenanceMode extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View file

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
class Marketing
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return $next($request);
}
}

View file

@ -0,0 +1,70 @@
<?php
namespace App\Http\Middleware;
use Closure;
use \App\Http\Controllers;
class ProcessSpecificUrl
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (isset($params['sessionuuid'])) {
Session::get($params['sessionuuid']);
}
$path = $request->path();
$params = $request->all();
$paramsCount = count($params);
$contact = new Controllers\ContactController;
$mur = new Controllers\MurController;
$panier = new Controllers\PanierController;
switch ($path) {
case 'updatecontact':
$res = $contact->updateContact($request);
break;
case 'delctrlcontact':
$res = $mur->deleteControlContact($request);
break;
case 'mntdispocampagne':
$res = $mur->montantDispoCampagne($request);
break;
case 'mntdispocontact':
$res = $mur->montantDispoContact($request);
break;
case 'updatebasket':
$res = $panier->updateBasket($request);
break;
case 'showbasket':
$res = $panier->showBasket($request);
break;
default:
switch ($paramsCount) {
case 1:
if (isset($params['sessionuuid'])) {
//
} else {
$res = $panier->showTemplate($request);
}
break;
case 3:
$res = $mur->show($request);
break;
default:
break;
}
break;
}
return $res;
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/bo/home');
}
return $next($request);
}
}

View file

@ -0,0 +1,49 @@
<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
use App\Site;
class SaveCurrentRoute
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$routeName = explode('.', \Route::currentRouteName());
session()->put('active_route', $routeName[0]);
$site = session()->get('site');
if (!isset($site)) {
session()->put('site', Auth::user()->sites->first());
}
$currentLogo = session()->get('site')->only(['site_logo']);
session()->put('current_logo', $currentLogo);
$siteId = session()->get('marques');
if (!isset($siteId)) {
if(Auth::user()->roles != "superadmin"){
$marques = Auth::user()->sites;
} else {
$marques = Site::all();
}
$submarques = $marques->map(function($marque){
return $marque->only(['id', 'site_nom', 'site_id', 'site_logo']);
});
session()->put('marques', $submarques);
}
return $next($request);
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
class SuperAdmin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Auth::check() && Auth::user()->roles == 'superadmin') {
return $next($request);
}
else {
return redirect('/bo/home');
}
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}

View file

@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

View file

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}

42
app/Mouvement.php Normal file
View file

@ -0,0 +1,42 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Mouvement extends Model
{
/**
* @var string
*/
protected $table = 'mouvement';
/**
* @var string
*/
protected $primaryKey = 'mouvement_id';
/**
* @var boolean
*/
public $timestamps = false;
protected $dates = ['mouvement_created_at'];
/**
* @var array
*/
protected $fillable = [
'mouvement_nombre',
'mouvement_created_at'
];
/**
* ManyToOne
* Mouvement -> Coupon
*/
public function coupon()
{
return $this->belongsTo('App\Coupon', 'mouvement_couponId');
}
}

50
app/Mur.php Normal file
View file

@ -0,0 +1,50 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Mur extends Model
{
/**
* @var string
*/
protected $table = 'mur';
/**
* @var string
*/
protected $primaryKey = 'mur_id';
/**
* @var bool
*/
public $timestamps = false;
/**
* ManyToOne
* Mur -> Campagne
*/
public function campagne()
{
return $this->belongsTo('App\Campagne', 'mur_campId');
}
/**
* ManyToOne
* Mur -> Contact
*/
public function contact()
{
return $this->belongsTo('App\Contact', 'mur_contactId');
}
/**
* ManyToOne
* Mur -> Coupon
*/
public function coupon()
{
return $this->belongsTo('App\Coupon', 'mur_couponId');
}
}

32
app/Notification.php Normal file
View file

@ -0,0 +1,32 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
/**
* @var string
*/
protected $table = 'notification';
/**
* @var string
*/
protected $primaryKey = 'notif_id';
/**
* @var bool
*/
public $timestamps = false;
/**
* ManyToOne
* Notification -> Campagne
*/
public function campagne()
{
return $this->belongsTo('App\Campagne', 'notif_campId');
}
}

50
app/Panier.php Normal file
View file

@ -0,0 +1,50 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Panier extends Model
{
/**
* @var string
*/
protected $table = 'panier';
/**
* @var string
*/
protected $primaryKey = 'panier_id';
/**
* @var bool
*/
public $timestamps = false;
/**
* OneToMany
* Panier -> PanierContent
*/
public function panierContents()
{
return $this->hasMany('App\PanierContent', 'panier_content_panierId', 'panierId');
}
/**
* ManyToOne
* Panier -> Campagne
*/
public function campagne()
{
return $this->belongsTo('App\Campagne', 'panier_campId');
}
/**
* ManyToOne
* Panier -> Contact
*/
public function contact()
{
return $this->belongsTo('App\Contact', 'panier_contactId');
}
}

41
app/PanierContent.php Normal file
View file

@ -0,0 +1,41 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class PanierContent extends Model
{
/**
* @var string
*/
protected $table = 'panier_content';
/**
* @var string
*/
protected $primaryKey = 'panier_content_id';
/**
* @var bool
*/
public $timestamps = false;
/**
* ManyToOne
* PanierContent -> Panier
*/
public function panier()
{
return $this->belongsTo('App\Panier', 'panier_content_panierId', 'panier_content_id');
}
/**
* ManyToOne
* PanierContent -> Coupon
*/
public function coupon()
{
return $this->belongsTo('App\Coupon', 'panier_content_couponId');
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(storage_path('app/public/landings'), 'landings');
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View file

@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}

View file

@ -0,0 +1,73 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}

76
app/Site.php Normal file
View file

@ -0,0 +1,76 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Site extends Model
{
/**
* @var string
*/
protected $table = 'site';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
* @var string
*/
protected $keyType = 'varchar';
/**
* @var bool
*/
public $timestamps = false;
/**
* @var array
*/
protected $fillable = ['site_nom', 'site_logo', 'site_contact'];
/**
* OneToMany
* Site -> Campagne
*/
public function campagnes()
{
return $this->hasMany('App\Campagne', 'camp_siteId', 'site_id');
}
/**
* OneToMany
* Site -> Contact
*/
public function contacts()
{
return $this->hasMany('App\Contact', 'contact_siteId', 'site_id');
}
/**
* The users that belong to the site.
*/
public function users()
{
return $this->belongsToMany('App\User', 'site_user', 'site_id', 'user_id');
}
/**
* OneToMany
* Site -> Coupon
*/
public function coupons()
{
return $this->hasMany('App\Coupon', 'coupon_siteId', 'id');
}
/**
* @return string
*/
public function __toString()
{
return $this->site_id . " : " . $this->site_nom;
}
}

38
app/User.php Normal file
View file

@ -0,0 +1,38 @@
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'roles',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The sites that belong to the user.
*/
public function sites()
{
return $this->belongsToMany('App\Site', 'site_user', 'user_id', 'site_id');
}
}

53
artisan Normal file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View file

@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

2
bootstrap/cache/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

66
composer.json Normal file
View file

@ -0,0 +1,66 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"doctrine/dbal": "^2.8",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.4.0",
"uxweb/sweet-alert": "^2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"laracasts/generators": "^1.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0",
"squizlabs/php_codesniffer": "^3.3"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

4658
composer.lock generated Normal file

File diff suppressed because it is too large Load diff

219
config/app.php Normal file
View file

@ -0,0 +1,219 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Mes BR'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'local'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://mesbr.test'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'fr',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Collective\Html\HtmlServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
],
];

102
config/auth.php Normal file
View file

@ -0,0 +1,102 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
],
];

59
config/broadcasting.php Normal file
View file

@ -0,0 +1,59 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

93
config/cache.php Normal file
View file

@ -0,0 +1,93 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];

127
config/database.php Normal file
View file

@ -0,0 +1,127 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'mesbr'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
],
'cache' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
],
],
];

201
config/debugbar.php Normal file
View file

@ -0,0 +1,201 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
'enabled' => env('DEBUGBAR_ENABLED', null),
'except' => [
//
],
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
],
/*
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
'capture_ajax' => true,
'add_ajax_timing' => false,
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
'error_handler' => false,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => false,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
],
/*
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
'options' => [
'auth' => [
'show_name' => true, // Also show the users name/email in the debugbar
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
'mail' => [
'full_log' => false
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => true // show complete route on bar
],
'logs' => [
'file' => null
],
'cache' => [
'values' => true // collect cache values
],
],
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => true,
/*
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
];

69
config/filesystems.php Normal file
View file

@ -0,0 +1,69 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => public_path(),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
];

52
config/hashing.php Normal file
View file

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];

92
config/logging.php Normal file
View file

@ -0,0 +1,92 @@
<?php
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];

123
config/mail.php Normal file
View file

@ -0,0 +1,123 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

86
config/queue.php Normal file
View file

@ -0,0 +1,86 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

39
config/services.php Normal file
View file

@ -0,0 +1,39 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => env('SES_REGION', 'us-east-1'),
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];

197
config/session.php Normal file
View file

@ -0,0 +1,197 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
];

33
config/view.php Normal file
View file

@ -0,0 +1,33 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),
];

1
database/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.sqlite

View file

@ -0,0 +1,24 @@
<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMouvementsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mouvement', function (Blueprint $table) {
$table->engine = 'MyISAM';
$table->increments('mouvement_id');
$table->unsignedInteger('mouvement_couponId');
$table->string('mouvement_type', 50);
$table->timestamp('mouvement_created_at');
$table->unsignedInteger('mouvement_nombre');
$table->string('mouvement_commentaire', 255)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('mouvement');
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSoftDelete extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('campagne', function (Blueprint $table) {
$table->softDeletes('camp_deleted_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('campagne', function (Blueprint $table) {
//
});
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRolesToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('roles')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('roles');
});
}
}

View file

@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSiteUserPivotTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('site', function (Blueprint $table) {
// $table->dropPrimary('site_id');
// $table->integer('id')->unsigned()->first()->autoIncrement();
// $table->primary('id');
// $table->engine = 'InnoDB';
// });
Schema::create('site_user', function (Blueprint $table) {
$table->integer('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->integer('site_id')->unsigned()->nullable();
$table->foreign('site_id')->references('id')->on('site')->onDelete('cascade');
$table->primary(['site_id', 'user_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('site_user');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddFieldsToSitesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('site', function (Blueprint $table) {
$table->string('site_rcs', 100)->nullable();
$table->string('site_libelle', 200)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('site', function (Blueprint $table) {
$table->dropColumn('site_rcs');
$table->dropColumn('site_libelle');
});
}
}

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDiffusiondatefieldToCouponsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('coupon', function (Blueprint $table) {
$table->date('coupon_maxdatediffusion')->nullable();
$table->string('coupon_products_image', 500)->nullable();
$table->string('coupon_validity_text', 500)->nullable();
$table->string('coupon_legal_mentions', 500)->nullable();
$table->dropColumn('coupon_quantity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('coupon', function (Blueprint $table) {
$table->integer('coupon_quantity');
$table->dropColumn('coupon_maxdatediffusion');
$table->dropColumn('coupon_products_image');
$table->dropColumn('coupon_validity_text');
$table->dropColumn('coupon_legal_mentions');
});
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCampagneCouponPivotTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('campagne_coupon', function (Blueprint $table) {
$table->integer('camp_id')->nullable();
$table->foreign('camp_id')->references('camp_id')->on('campagne')->onDelete('cascade');
$table->integer('coupon_id')->nullable();
$table->foreign('coupon_id')->references('coupon_id')->on('coupon')->onDelete('cascade');
$table->primary(['camp_id', 'coupon_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('campagne_coupon');
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddCountryfieldToContactTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('contact', function (Blueprint $table) {
$table->unsignedInteger('contact_country')->default(250);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('contact', function (Blueprint $table) {
$table->dropColumn('contact_country');
});
}
}

View file

@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
}
}

10734
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

25
package.json Normal file
View file

@ -0,0 +1,25 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"browser-sync": "^2.24.7",
"browser-sync-webpack-plugin": "2.0.1",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"sweetalert": "^2.0.8",
"vue": "^2.5.7"
}
}

33
phpunit.xml Normal file
View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="MAIL_DRIVER" value="array"/>
</php>
</phpunit>

21
public/.htaccess Normal file
View file

@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Some files were not shown because too many files have changed in this diff Show more