Jump to content

maxudaskin

Members
  • Posts

    628
  • Joined

  • Last visited

Everything posted by maxudaskin

  1. Hello all and happy holidays! I am having a brain fart with my regex and cannot seem to wrap my head around what I am doing wrong. $regex = '/(?:<thead><tr>)(<th>(.*)<\/th>)+(?:<\/tr><\/thead>)/'; $subject = '<thead><tr><th>Day</th><th>Date</th><th>Duty</th><th>From</th><th>Report</th><th>To</th><th>Release</th><th>Flight Time</th><th>Duty Time</th><th>TAFB Time</th><th>Rest Time</th><th>Sector(s)/Event(s)</th></tr></thead><tbody>...more string'; What I am hoping to get out of this is ['Day', 'Duty', 'From', 'Report',] // ... and so on But I'm getting this instead Array( '<thead><tr><th>Day</th><th>Date</th><th>Duty</th><th>From</th><th>Report</th><th>To</th><th>Release</th><th>Flight Time</th><th>Duty Time</th><th>TAFB Time</th><th>Rest Time</th><th>Sector(s)/Event(s)</th></tr></thead>', '<th>Day</th><th>Date</th><th>Duty</th><th>From</th><th>Report</th><th>To</th><th>Release</th><th>Flight Time</th><th>Duty Time</th><th>TAFB Time</th><th>Rest Time</th><th>Sector(s)/Event(s)</th>', 'Day</th><th>Date</th><th>Duty</th><th>From</th><th>Report</th><th>To</th><th>Release</th><th>Flight Time</th><th>Duty Time</th><th>TAFB Time</th><th>Rest Time</th><th>Sector(s)/Event(s)', )
  2. <?php // FlightEntryController.php ... class FlightEntryController extends Controller { public function __construct() { $this->authorizeResource(FlightEntry::class); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(FlightEntry $flight) { dd($flight); } ... } // FlightEntryPolicy.php class FlightEntryPolicy { use HandlesAuthorization; ... /** * Determine whether the user can view the model. * * @param \App\Models\User $user * @param \App\Models\FlightEntry $flightEntry * @return \Illuminate\Auth\Access\Response|bool */ public function view(User $user, FlightEntry $flightEntry) { dd($user); if($user->hasPermissionTo('view flights not owned')) { // Spatie return Response::allow(); } if($user->id === $flightEntry->user_id) { return Response::allow(); } return Response::deny(null, 404); } ... } // AuthServiceProvider.php class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ App\Models\FlightEntry::class => App\Policies\FlightEntryPolicy::class, ]; ... } // routes/web.php Route::resource('/flights', FlightEntryController::class)->middleware('auth'); With the policy not attached, everything works fine. When I attach the policy, index (viewAny) works, but show (view) does not. It throws a 403 and does not run the dd inside. I'm going crazy. Any suggestions?
  3. Turns out OpenCart has been modifying the source and adding an additional } that is creating a syntax error. Off to find the root of this issue.
  4. Hi guys, I'm customizing an OpenCart template that is riddled with programming bugs. It is MVC and I am having a really odd issue with a controller file. The template that I want to use is not loading. I have edited the one in the selected template and also the default, but no avail. I was troubleshooting why it wasn't working and I came to the conclusion that either I am completely blind or stupid, or PHP is all of a sudden a troll. Please let me know if you need more context, but here is a snippet of the code and the result. I am really at a loss right now. Result: 14 Code: echo "1"; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) { echo "2";die(); $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/category.tpl', $data)); } else { echo "3";die(); $this->response->setOutput($this->load->view('default/template/product/category.tpl', $data)); } echo "4";die();
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.