Commit 73563aea by Angel MAS

first module

parents
# Package test OneStartup
**onestartup/crm** is a module to manipulate the information that arrives through the forms of our project
# Installation
- Add this to composer.json file
```php
"onestartup/crm": "~0.0.1"
```
and run
```php
composer update
````
- after add the ServiceProvider to the providers array in config/app.php
```php
Onestartup\Crm\CrmListServiceProvider::class,
````
- run serv
```php
php artisan serve
```
- test in this route how admin user
```php
http://localhost:8000/admin/crm
```
\ No newline at end of file
{
"name": "onestartup/crm",
"description": "record management with tracking log",
"type": "library",
"license": "Apache-2.0",
"authors": [
{
"name": "Angel MAS",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"psr-4": {"Onestartup\\Crm\\": "src"}
}
}
<?php
namespace Onestartup\Crm;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Yajra\Datatables\Datatables;
use App\Interested;
class AdminCrmController extends Controller
{
public function list()
{
return view('crm::list')->with('var', 'varx');
}
public function datatable()
{
$interesteds = Interested::select(['id','name','email', 'phone','landing','origin','created_at'])->orderBy('id', 'desc');
return Datatables::of($interesteds)
->addColumn('details_url', function ($interested) {
return "<a href='".route('crm.show',$interested->id)."'>Ver Detalle</a>";
})
->rawColumns(['details_url'])
->make();
}
public function show($id)
{
return "asd";
}
}
<?php
namespace Onestartup\Crm;
use Illuminate\Support\ServiceProvider;
class CrmListServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
include __DIR__.'/routes.php';
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->make('Onestartup\Crm\AdminCrmController');
$this->loadViewsFrom(__DIR__.'/views', 'crm');
}
}
<?php
Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
Route::get('admin/crm','Onestartup\Crm\AdminCrmController@list')->name('crm.list');
Route::get('admin/crm/datatable','Onestartup\Crm\AdminCrmController@datatable')->name('crm.datatable');
Route::get('admin/crm/{id}/show','Onestartup\Crm\AdminCrmController@show')->name('crm.show');
});
@extends('layouts.admin.admin-layout')
@section('content')
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box-header dark">
<h2>Listado de clientes</h2>
</div>
<div class="box-body">
<div class='table-responsive'>
<table class='table table-striped b-t b-b table-hover' id='registros'>
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Correo</th>
<th>Teléfono</th>
<th>Landing</th>
<th>Origin</th>
<th>Fecha de registro</th>
<th>URL</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="dker p-a text-right">
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
$(function() {
$('#registros').DataTable({
processing: true,
serverSide: true,
pageLength: 25,
ajax: '{{ route("crm.datatable") }}',
columns: [
{data: 'id', name: 'id'},
{data: 'name', name: 'name'},
{data: 'email', name: 'email'},
{data: 'phone', name: 'phone'},
{data: 'landing', name: 'landing'},
{data: 'origin', name: 'origin'},
{data: 'created_at', name: 'created_at'},
{data: 'details_url', name: 'details_url'}
]
});
});
</script>
@endpush
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInita0df12a1011c6c35583bc8f154f0ac9d::getLoader();
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Onestartup\\Crm\\' => array($baseDir . '/src'),
);
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita0df12a1011c6c35583bc8f154f0ac9d
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInita0df12a1011c6c35583bc8f154f0ac9d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInita0df12a1011c6c35583bc8f154f0ac9d', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInita0df12a1011c6c35583bc8f154f0ac9d::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInita0df12a1011c6c35583bc8f154f0ac9d
{
public static $prefixLengthsPsr4 = array (
'O' =>
array (
'Onestartup\\Crm\\' => 15,
),
);
public static $prefixDirsPsr4 = array (
'Onestartup\\Crm\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita0df12a1011c6c35583bc8f154f0ac9d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita0df12a1011c6c35583bc8f154f0ac9d::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment